:root {
  color-scheme: light;
  --bg: #f7f6f2;
  --ink: #1d2939;
  --muted: #667085;
  --line: #e3ded4;
  --panel: #ffffff;
  --accent: #a34b56;
  --accent-ink: #ffffff;
  --ok: #177245;
  --warn: #9b5b13;
  --shadow: 0 10px 30px rgba(29, 41, 57, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

select {
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: white;
  color: var(--ink);
  font: inherit;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  font-weight: 700;
  cursor: pointer;
}

button:disabled {
  opacity: 0.55;
}

.hidden {
  display: none !important;
}

.shell {
  width: min(680px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 14px max(20px, env(safe-area-inset-bottom));
}

.login-view {
  min-height: 86vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
}

.logo {
  width: 92px;
  height: 92px;
  object-fit: cover;
  border-radius: 20px;
  box-shadow: var(--shadow);
}

h1,
h2,
p {
  margin: 0;
}

.login-view h1,
.topbar h1 {
  font-size: 28px;
  line-height: 1.1;
}

.login-form {
  display: grid;
  gap: 10px;
}

input {
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: white;
  color: var(--ink);
}

.secondary {
  background: #ffffff;
  color: var(--ink);
  border: 1px solid var(--line);
}

.error {
  min-height: 20px;
  color: #b42318;
  font-size: 14px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0 12px;
}

.detail-topbar {
  justify-content: flex-start;
}

.eyebrow {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.icon-button {
  width: 46px;
  min-width: 46px;
  padding: 0;
  border-radius: 50%;
  font-size: 26px;
  line-height: 1;
}

.filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin: 2px 0 12px;
}

.filters button {
  min-height: 38px;
  padding: 0 8px;
  background: white;
  color: var(--ink);
  border: 1px solid var(--line);
  font-size: 13px;
}

.filters button.active {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}

.setup-panel,
.detail-card,
.action-panel,
.order-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.setup-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  margin-bottom: 12px;
}

.setup-panel span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.setup-panel button {
  min-height: 38px;
  padding: 0 12px;
  background: var(--accent);
}

.status {
  min-height: 22px;
  color: var(--muted);
  font-size: 14px;
  padding: 2px 0 8px;
}

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

.order-card {
  width: 100%;
  display: grid;
  gap: 8px;
  padding: 12px;
  color: var(--ink);
  text-align: left;
  background: white;
}

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

.order-number {
  font-size: 21px;
  font-weight: 800;
}

.date {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.customer {
  font-weight: 700;
}

.lines {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #f2f4f7;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.badge.littlefrog {
  background: #e8f5ec;
  color: var(--ok);
}

.badge.external {
  background: #fff3df;
  color: var(--warn);
}

.detail-card,
.action-panel {
  padding: 14px;
  margin-bottom: 12px;
}

.detail-card h2 {
  margin-bottom: 8px;
  font-size: 17px;
}

.card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.card-heading h2 {
  margin-bottom: 0;
}

.small-button {
  min-height: 34px;
  padding: 0 12px;
  background: #ffffff;
  color: var(--ink);
  border: 1px solid var(--line);
  font-size: 13px;
}

.address-form {
  display: grid;
  gap: 9px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.field-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

.field-pair.compact {
  grid-template-columns: minmax(86px, 0.8fr) minmax(0, 1.2fr);
}

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

.form-actions button {
  width: 100%;
}

#detailAddress,
.line-item {
  color: var(--ink);
  line-height: 1.4;
}

.line-item {
  display: grid;
  gap: 4px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.line-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.line-meta {
  color: var(--muted);
  font-size: 13px;
}

.action-panel button {
  width: 100%;
  background: var(--accent);
  color: var(--accent-ink);
}

.supplier-links {
  display: grid;
  gap: 8px;
}

.supplier-links a {
  display: block;
  padding: 12px;
  border-radius: 8px;
  background: #f9fafb;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  word-break: break-word;
}
