:root {
  color-scheme: light;
  --ink: #1d2939;
  --muted: #667085;
  --line: #d0d5dd;
  --bg: #f7f8fa;
  --panel: #ffffff;
  --accent: #116c5b;
  --accent-dark: #0b4f43;
  --danger: #b42318;
  --income: #175cd3;
  font-family: Arial, "Noto Sans Thai", "Microsoft JhengHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px;
  background: #e7f4ef;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.15;
}

main {
  padding: 12px 16px 24px;
}

.actions,
.report-settings,
.summary {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 6px;
  padding: 7px 10px;
  cursor: pointer;
}

.actions select {
  width: 260px;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.add-item-btn {
  align-self: end;
  background: #175cd3;
  border-color: #175cd3;
  color: #fff;
  font-weight: 700;
  min-width: 120px;
}

button:hover {
  border-color: var(--accent);
}

button.primary:hover {
  background: var(--accent-dark);
}

.add-item-btn:hover {
  background: #1849a9;
  border-color: #1849a9;
}

.report-settings {
  align-items: end;
  margin-bottom: 10px;
}

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

input,
select,
textarea {
  width: 100%;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 7px;
  color: var(--ink);
  background: #fff;
}

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

.report-settings label {
  min-width: 180px;
}

.report-settings label:last-child {
  min-width: 840px;
  flex: 0 1 840px;
}

.item-actions {
  display: flex;
  justify-content: flex-start;
  margin: -2px 0 10px;
}

.table-wrap {
  overflow-x: auto;
  background: var(--panel);
  border: 1px solid var(--line);
}

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

th,
td {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 4px;
  vertical-align: top;
}

th {
  background: #eef4f2;
  text-align: left;
  font-size: 12px;
  line-height: 1.2;
}

td:first-child,
th:first-child {
  width: 42px;
  text-align: center;
}

td:nth-child(2),
td:nth-child(3) {
  width: 116px;
}

td:nth-child(8) {
  width: 110px;
}

.row-number {
  font-weight: 700;
  padding-top: 12px;
}

.bill-input {
  width: 150px;
}

.bill-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.row-tools {
  width: 92px;
  white-space: nowrap;
}

.copy-btn {
  color: #175cd3;
  padding: 5px 7px;
  font-size: 12px;
}

.remove-btn {
  color: #fff;
  background: var(--danger);
  border-color: var(--danger);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  margin-left: 4px;
}

.remove-btn:hover {
  background: #912018;
  border-color: #912018;
}

.translate-status {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.summary {
  justify-content: flex-end;
  margin-top: 10px;
}

.summary div {
  min-width: 170px;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 10px;
}

.summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.summary strong {
  font-size: 18px;
}

.cloud-status {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.status-badge {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  color: var(--muted);
  font-size: 11px;
  vertical-align: middle;
}

.status-badge.closed {
  color: var(--danger);
  border-color: #fecdca;
  background: #fffbfa;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.login-panel {
  width: min(360px, calc(100vw - 32px));
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 22px;
}

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

@media (max-width: 760px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
    padding: 18px;
  }

  main {
    padding: 18px;
  }

  .actions button,
  .report-settings label,
  .summary div {
    width: 100%;
  }
}
