:root {
  color-scheme: light;
  --ink: #172026;
  --muted: #64707d;
  --line: #d9e1e7;
  --surface: #ffffff;
  --wash: #f5f7f8;
  --brand: #f28c28;
  --brand-dark: #c76710;
  --accent: #8f3f00;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: #f7f4ef;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.brand-logo {
  width: 94px;
  height: 48px;
  object-fit: contain;
}

.tabs {
  display: flex;
  gap: 8px;
}

.tab,
button {
  min-height: 40px;
  border: 1px solid var(--brand);
  border-radius: 6px;
  padding: 0 16px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.tab {
  background: #fff;
  color: var(--brand-dark);
}

.tab.active,
button:hover {
  background: var(--brand-dark);
  color: #fff;
}

button.secondary {
  background: #fff;
  color: var(--brand-dark);
}

button.small {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 28px auto;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.panel-head {
  padding: 24px;
  border-bottom: 1px solid var(--line);
}

.panel-head.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

h1 {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 900;
  text-transform: uppercase;
}

p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.form {
  display: grid;
  gap: 18px;
  padding: 24px;
}

.quick-lookup {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(180px, 1fr);
  align-items: end;
  gap: 12px;
  padding: 16px;
  border: 1px solid #ecd0ad;
  border-radius: 8px;
  background: #fff8ef;
}

#lookupStatus {
  color: var(--muted);
  font-size: 13px;
}

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

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

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

label {
  display: grid;
  gap: 7px;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cbd5df;
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--ink);
  font: inherit;
  background: #fff;
}

textarea {
  resize: vertical;
}

.signature-box {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf5;
}

.signature-box p {
  font-size: 13px;
}

canvas {
  width: 100%;
  height: 180px;
  border: 1px solid #d7b58d;
  border-radius: 6px;
  background: #fff;
  touch-action: none;
}

.signature-actions,
.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.file {
  padding: 14px;
  border: 1px dashed #9fb1bf;
  border-radius: 8px;
  background: #fafafa;
}

.actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

#formStatus {
  color: var(--muted);
  font-size: 14px;
}

.hidden {
  display: none;
}

.auth-panel {
  max-width: 520px;
  margin: 0 auto;
}

.compact-form {
  gap: 14px;
}

.table-wrap {
  overflow: auto;
}

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

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
  text-transform: uppercase;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  background: #fff4e6;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.status.paid {
  background: #ecfdf3;
  color: #166534;
}

.email {
  color: var(--accent);
  font-weight: 700;
}

a {
  color: var(--brand-dark);
  font-weight: 700;
}

@media (max-width: 760px) {
  .topbar,
  .panel-head.row,
  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  .tabs {
    width: 100%;
  }

  .brand-logo {
    width: 84px;
  }

  .tab {
    flex: 1;
  }

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

  main {
    width: min(100% - 20px, 1180px);
    margin: 16px auto;
  }
}
