* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", sans-serif;
  background: #fafafa;
  color: #222;
  line-height: 1.5;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}

header h1 {
  font-size: 1.6em;
  margin: 0 0 4px;
}

header .subtitle {
  color: #666;
  margin: 0 0 24px;
  font-size: 0.9em;
}

.card {
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  padding: 18px 20px;
  margin-bottom: 16px;
}

.card h2 {
  margin: 0 0 12px;
  font-size: 1.0em;
  color: #444;
  font-weight: 600;
}

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

input[type="password"],
input[type="text"],
select,
input[type="file"] {
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.92em;
  font-family: inherit;
}

input[type="password"],
input[type="text"] {
  min-width: 280px;
}

button {
  padding: 8px 14px;
  background: #4a4a4a;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.92em;
  font-weight: 500;
  font-family: inherit;
}

button:hover:not(:disabled) {
  background: #2c2c2c;
}

button:disabled {
  background: #ccc;
  cursor: not-allowed;
}

button.primary {
  background: #2c7be5;
  font-size: 1.0em;
  padding: 10px 20px;
}

button.primary:hover:not(:disabled) {
  background: #1e5fc4;
}

.muted {
  color: #888;
  font-size: 0.88em;
}

.region-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}

.region-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  user-select: none;
  font-size: 0.9em;
}

.region-chip:hover {
  background: #f5f5f5;
}

.region-chip input[type="checkbox"] {
  margin: 0;
}

.region-chip .region-tag {
  margin-left: auto;
  font-size: 0.75em;
  color: #888;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 0.9em;
}

th, td {
  padding: 8px 10px;
  border-bottom: 1px solid #eee;
  text-align: left;
  vertical-align: top;
}

th {
  background: #f7f7f7;
  font-weight: 600;
  color: #444;
}

th.group-header {
  text-align: center;
  background: #efefef;
  border-bottom: 1px solid #ddd;
  font-size: 0.85em;
}

th.client-header { background: #e0f0ff; color: #1a4f7a; }
td.client-cell { background: #f5fafc; }

.region-undeployed { opacity: 0.55; cursor: not-allowed; }
.region-undeployed input { cursor: not-allowed; }

td.numeric, th.numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

input[type="number"] {
  width: 80px;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.92em;
  font-family: inherit;
}

td.delta-negative { color: #1f7a3a; font-weight: 600; }
td.delta-positive { color: #b22222; font-weight: 600; }
td.delta-zero { color: #888; }

td.transcript, td.translation {
  font-size: 0.85em;
  color: #555;
  max-width: 240px;
  word-wrap: break-word;
}

td.error-cell {
  color: #b22222;
  font-style: italic;
}

.hidden { display: none; }

.error-card {
  border-color: #d33;
  background: #fff5f5;
}

.error-card h2 { color: #c00; }

pre#rawJson {
  background: #1e1e1e;
  color: #d4d4d4;
  padding: 12px;
  border-radius: 4px;
  overflow-x: auto;
  font-size: 0.85em;
  margin-top: 12px;
}

pre#errorMessage {
  background: #fff;
  padding: 12px;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.88em;
  color: #c00;
}
