:root {
  --ink: #1c2f34;
  --muted: #5b6a6e;
  --teal: #1f6f78;
  --teal-dark: #0c7f88;
  --line: #cfdddf;
  --bg: #f4f7f7;
  --card: #ffffff;
  --red: #be3a3a;
  --yellow: #d6a926;
  --green: #2a8e4c;
}

* { box-sizing: border-box; }

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

.app-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: #000;
  color: #fff;
}

.logo {
  width: 72px;
  height: 72px;
  object-fit: cover;
  background: #fff;
}

h1, h2, h3, p { margin: 0; }
h1 { font-size: 24px; }
.app-header p { margin-top: 6px; color: #cce2e6; }

.candidate-strip {
  display: flex;
  overflow-x: auto;
  gap: 8px;
  padding: 8px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.candidate-strip button {
  min-width: 152px;
  min-height: 56px;
  padding: 8px 10px;
  white-space: normal;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 8px;
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 2;
  border-bottom: 1px solid var(--line);
}

button {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef7f8;
  color: var(--teal);
  font: inherit;
  font-weight: 700;
}

.button-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  margin-top: 8px;
  border: 1px solid var(--teal);
  border-radius: 8px;
  background: #fff;
  color: var(--teal);
  font-weight: 700;
  text-decoration: none;
}

button.active {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

.screen {
  padding: 14px 16px 120px;
  max-width: 1040px;
  margin: 0 auto;
}

.panel, .card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 2px 10px rgba(28, 47, 52, 0.05);
}

.panel h2, .card h3 { margin-bottom: 10px; }
.muted { color: var(--muted); margin-bottom: 14px; line-height: 1.35; }

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

label, fieldset {
  display: block;
  margin: 12px 0;
  color: #4b5355;
  font-weight: 700;
  font-size: 14px;
}

input, select, textarea {
  width: 100%;
  min-height: 50px;
  margin-top: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  padding: 10px 12px;
}

textarea { min-height: 96px; resize: vertical; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
legend { padding: 0 6px; }

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0;
  font-weight: 500;
}

.check input { width: 24px; min-height: 24px; margin: 0; }

.primary {
  width: 100%;
  margin-top: 10px;
  background: var(--teal-dark);
  border-color: var(--teal-dark);
  color: #fff;
}

.secondary {
  width: 100%;
  margin-top: 8px;
  background: #fff;
  border-color: var(--teal);
  color: var(--teal);
}

.danger {
  border-color: var(--red);
  color: var(--red);
  background: #fff;
}

.metric {
  font-size: 28px;
  font-weight: 700;
  color: var(--teal);
}

.bar-track {
  display: flex;
  height: 16px;
  border-radius: 8px;
  overflow: hidden;
  background: #e8eff0;
}

.bar-fill { min-width: 2%; border-radius: 8px; }
.red { background: var(--red); }
.yellow { background: var(--yellow); }
.green { background: var(--green); }
.teal { background: var(--teal); }

.row-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

#toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  min-height: 48px;
  padding: 14px 16px;
  border-radius: 8px;
  background: rgba(28, 47, 52, 0.94);
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 160ms ease, transform 160ms ease;
  z-index: 10;
}

#toast.visible {
  opacity: 1;
  transform: translateY(0);
}

[hidden] { display: none !important; }

@media (min-width: 860px) {
  .tabs { grid-template-columns: repeat(8, minmax(0, 1fr)); }
}
