@import url("https://fonts.googleapis.com/css2?family=Google+Sans:wght@400;500;700&family=Roboto:wght@400;500;700&family=Noto+Sans+SC:wght@400;500;700&display=swap");

:root {
  --blue: #1a73e8;
  --blue-hover: #174ea6;
  --blue-soft: #e8f0fe;
  --text: #202124;
  --muted: #5f6368;
  --line: #dadce0;
  --bg: #f8f9fa;
  --card: #fff;
  --green: #188038;
  --red: #d93025;
  --shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  color: var(--text);
  background: var(--bg);
  font-family: "Google Sans", Roboto, "Noto Sans SC", "Segoe UI", sans-serif;
}

.hidden {
  display: none !important;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  width: min(960px, calc(100% - 40px));
  margin: 0 auto;
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  width: 32px;
  height: 32px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
}

.g {
  border-radius: 2px;
}
.g1 { background: #4285f4; }
.g2 { background: #ea4335; }
.g3 { background: #fbbc04; }
.g4 { background: #34a853; }

.brand-text {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.brand-text strong {
  font-size: 22px;
  font-weight: 500;
}

.brand-text span {
  color: var(--muted);
  font-size: 14px;
}

.stage {
  width: min(960px, calc(100% - 40px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

h1,
h2 {
  margin: 0;
  font-weight: 500;
}

h1 {
  font-size: 28px;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 16px;
  color: var(--text);
}

.lead,
.hint,
.empty,
.over,
footer {
  color: var(--muted);
}

.lead {
  margin: 8px 0 24px;
  line-height: 1.6;
  max-width: 46em;
}

.card {
  background: var(--card);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 16px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.card-actions {
  margin-top: 8px;
}

#gate-form {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 12px 14px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.18);
}

button {
  border: 0;
  border-radius: 24px;
  background: var(--blue);
  color: #fff;
  padding: 10px 24px;
  font-weight: 500;
  cursor: pointer;
}

button:hover {
  background: var(--blue-hover);
}

button.ghost {
  background: transparent;
  color: var(--blue);
  border: 1px solid var(--line);
}

button.ghost:hover {
  background: var(--blue-soft);
}

.error {
  color: var(--red);
  min-height: 1.2em;
  margin: 12px 0 0;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 20px;
}

.over {
  margin: 0 0 4px;
  font-size: 12px;
}

.chip {
  display: inline-flex;
  align-items: center;
  border-radius: 16px;
  padding: 4px 10px;
  background: #f1f3f4;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.chip.on {
  background: #e6f4ea;
  color: var(--green);
}

.range-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 16px 0 8px;
}

.hint {
  margin: 12px 0 0;
  font-size: 13px;
  line-height: 1.5;
}

.stat-rows {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}

.stat-rows li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.stat-rows li:last-child {
  border-bottom: 0;
}

.stat-rows .label {
  color: var(--text);
}

.stat-rows .value {
  color: var(--blue);
  font-weight: 500;
  text-align: right;
}

.stat-rows li.compare {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr 1fr;
  gap: 8px;
}

.stat-rows .sub {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}

.diff-up {
  color: var(--green) !important;
}

.diff-down {
  color: var(--red) !important;
}

#goods-search {
  width: min(220px, 48vw);
  padding: 8px 12px;
}

.table-wrap {
  max-height: 420px;
  overflow: auto;
  margin-top: 8px;
}

.goods-table {
  width: 100%;
  border-collapse: collapse;
}

.goods-table th,
.goods-table td {
  padding: 12px 8px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.goods-table th {
  position: sticky;
  top: 0;
  background: #fff;
  color: var(--muted);
  font-weight: 500;
}

.goods-table td:last-child,
.goods-table th:last-child {
  text-align: right;
  color: var(--blue);
  font-weight: 500;
}

.empty {
  padding: 8px 0 4px;
  font-size: 13px;
}

#event-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.event {
  display: grid;
  grid-template-columns: 120px 64px 1fr;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.event .time,
.event .kind {
  color: var(--muted);
}

.event.error .kind,
.event.error .message {
  color: var(--red);
}

.live {
  font-size: 12px;
  color: var(--muted);
}

.live::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--red);
}

.live.on::before {
  background: var(--green);
}

footer {
  text-align: center;
  padding: 8px 16px 40px;
  font-size: 12px;
}

@media (max-width: 720px) {
  .stage,
  .topbar-inner {
    width: calc(100% - 24px);
  }

  #gate-form,
  .range-form,
  .event {
    display: block;
  }

  #gate-form button {
    width: 100%;
    margin-top: 12px;
  }

  .toolbar {
    align-items: center;
  }

  h1 {
    font-size: 24px;
  }
}
