:root {
  --black: #08090c;
  --black-soft: #111319;
  --panel: #181b22;
  --panel-light: #20242e;
  --red: #e21b2d;
  --red-dark: #a80f1c;
  --white: #f7f7f8;
  --muted: #a7adba;
  --line: #303541;
  --success: #24c27a;
  --danger: #ff6270;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--black);
  color: var(--white);
}

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

button,
a {
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

button:hover,
a:hover {
  transform: translateY(-1px);
}

.hidden {
  display: none !important;
}

.login-view {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.95fr);
  min-height: 100vh;
}

.brand-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(32px, 8vw, 96px);
  background:
    linear-gradient(120deg, rgba(226, 27, 45, 0.9), rgba(8, 9, 12, 0.78)),
    url("https://images.unsplash.com/photo-1534438327276-14e5300c3a48?auto=format&fit=crop&w=1400&q=80") center/cover;
  position: relative;
  overflow: hidden;
}

.brand-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(8, 9, 12, 0.2), rgba(8, 9, 12, 0.72));
}

.brand-panel > * {
  position: relative;
  z-index: 1;
}

.brand-mark {
  align-items: center;
  border: 2px solid rgba(255, 255, 255, 0.86);
  border-radius: 8px;
  display: inline-flex;
  height: 78px;
  justify-content: center;
  margin-bottom: 32px;
  position: relative;
  width: 118px;
}

.brand-mark span,
.brand-mark::before,
.brand-mark::after {
  background: var(--white);
  content: "";
  height: 12px;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
}

.brand-mark span {
  left: -20px;
}

.brand-mark::before {
  right: -20px;
}

.brand-mark::after {
  height: 54px;
  left: 18px;
  width: 6px;
}

.brand-mark strong {
  font-size: 28px;
  letter-spacing: 0;
  margin-left: 16px;
}

.eyebrow {
  color: #ff9ca5;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 8px;
  text-transform: uppercase;
}

.brand-panel h1 {
  font-size: clamp(48px, 8vw, 88px);
  line-height: 0.95;
  margin: 0 0 22px;
}

.brand-panel p:last-child {
  color: rgba(255, 255, 255, 0.88);
  font-size: 20px;
  line-height: 1.55;
  max-width: 620px;
}

.login-card {
  align-self: center;
  background: var(--black-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  margin: 24px;
  padding: clamp(24px, 5vw, 46px);
}

h2,
h3,
p {
  margin-top: 0;
}

h2 {
  font-size: clamp(28px, 4vw, 42px);
  margin-bottom: 8px;
}

h3 {
  font-size: 18px;
  margin-bottom: 18px;
}

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

.hint {
  font-size: 13px;
  line-height: 1.45;
}

.stack,
.form-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

label {
  color: var(--muted);
  display: grid;
  font-size: 13px;
  font-weight: 700;
  gap: 8px;
}

input,
select {
  background: #0f1117;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--white);
  min-height: 46px;
  outline: none;
  padding: 0 14px;
}

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 19px, calc(100% - 12px) 19px;
  background-repeat: no-repeat;
  background-size: 6px 6px, 6px 6px;
  padding-right: 38px;
}

input:focus,
select:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(226, 27, 45, 0.18);
}

.primary-btn,
.ghost-btn,
.whatsapp-btn,
.ghost-link {
  align-items: center;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  font-weight: 800;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  text-decoration: none;
}

.primary-btn {
  background: var(--red);
  border: 1px solid var(--red);
  color: var(--white);
}

.primary-btn:hover {
  background: #f0273a;
}

.ghost-btn,
.ghost-link {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--white);
}

.whatsapp-btn {
  background: #1fac5d;
  border: 1px solid #1fac5d;
  color: var(--white);
}

.whatsapp-btn.disabled {
  opacity: 0.45;
  pointer-events: none;
}

.error {
  color: var(--danger);
  font-size: 14px;
  min-height: 20px;
}

.topbar {
  align-items: center;
  background: rgba(8, 9, 12, 0.94);
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(210px, 1fr) auto auto;
  padding: 16px clamp(18px, 4vw, 44px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.logo-wrap {
  align-items: center;
  display: flex;
  gap: 12px;
}

.mini-logo {
  align-items: center;
  background: var(--red);
  border-radius: 6px;
  display: flex;
  font-weight: 900;
  height: 42px;
  justify-content: center;
  width: 52px;
}

.logo-wrap span {
  color: var(--muted);
  display: block;
  font-size: 12px;
}

.tabs {
  background: var(--black-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  padding: 4px;
}

.tab {
  background: transparent;
  border: 0;
  border-radius: 5px;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
  min-height: 38px;
  padding: 0 16px;
}

.tab.active {
  background: var(--red);
  color: var(--white);
}

.content {
  padding: clamp(18px, 4vw, 44px);
}

.view-section {
  display: none;
}

.view-section.active {
  display: block;
}

.section-head {
  align-items: end;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.workspace-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(300px, 0.8fr) minmax(0, 1.2fr);
  margin-bottom: 20px;
}

.panel {
  background: var(--black-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
}

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

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

.table-title {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.table-title h3 {
  margin: 0;
}

.table-title span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.table-scroll {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  min-width: 680px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 13px 10px;
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

td {
  color: #e7e9ee;
  font-size: 14px;
}

.search-box {
  margin-bottom: 18px;
}

.search-results {
  display: grid;
  gap: 10px;
}

.result-card {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 7px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
}

.result-card strong {
  display: block;
  margin-bottom: 4px;
}

.result-card span {
  color: var(--muted);
  font-size: 13px;
}

.receipt-panel {
  min-width: 0;
}

canvas {
  background: white;
  border-radius: 8px;
  display: block;
  height: auto;
  max-width: 100%;
  width: 100%;
}

.empty {
  color: var(--muted);
  padding: 18px 0;
}

@media (max-width: 960px) {
  .login-view,
  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .brand-panel {
    min-height: 42vh;
  }

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

  .tabs {
    overflow-x: auto;
    width: 100%;
  }

  .tab {
    flex: 1;
  }
}

@media (max-width: 620px) {
  .login-card {
    margin: 0;
    border-radius: 0;
  }

  .section-head,
  .result-card,
  .table-title {
    align-items: stretch;
    flex-direction: column;
  }

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

  .content {
    padding: 16px;
  }
}
