:root {
  --background: #f5f7f8;
  --foreground: #172027;
  --muted: #64707a;
  --line: #d8dee4;
  --panel: #ffffff;
  --panel-soft: #eef3f3;
  --teal: #11777b;
  --teal-dark: #0b5659;
  --coral: #c8563e;
  --green: #6c872f;
  --amber: #b47518;
  --ink: #172027;
  --shadow: 0 16px 36px rgba(23, 32, 39, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--background);
}

body {
  background: var(--background);
  color: var(--foreground);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  margin: 0;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.54;
}

.hidden {
  display: none !important;
}

.tracker-shell {
  min-height: 100vh;
  padding: 24px;
}

.tracker-header {
  align-items: end;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 20px;
  justify-content: space-between;
  margin: 0 auto 18px;
  max-width: 1440px;
  padding: 18px 0 22px;
}

.eyebrow {
  color: var(--teal);
  font-size: 0.74rem;
  font-weight: 760;
  letter-spacing: 0;
  margin: 0 0 6px;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  color: var(--ink);
  font-size: clamp(2.1rem, 4vw, 4.2rem);
  font-weight: 820;
  line-height: 0.94;
  margin-bottom: 0;
}

h2 {
  color: var(--ink);
  font-size: 1.1rem;
  line-height: 1.2;
  margin-bottom: 0;
}

h3 {
  font-size: 0.96rem;
  margin-bottom: 4px;
}

.week-control {
  align-items: end;
  display: flex;
  gap: 8px;
}

.week-control label {
  display: grid;
  gap: 7px;
}

.week-control span,
label span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 720;
}

input,
select,
textarea {
  background: #fff;
  border: 1px solid #cfd7dd;
  border-radius: 6px;
  color: var(--ink);
  min-height: 40px;
  outline: none;
  padding: 9px 11px;
  width: 100%;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(17, 119, 123, 0.14);
}

.icon-button,
.ghost-button,
.primary-button,
.table-button,
.segmented-control button {
  align-items: center;
  border-radius: 6px;
  display: inline-flex;
  font-size: 0.88rem;
  font-weight: 760;
  justify-content: center;
  min-height: 40px;
  text-align: center;
  white-space: nowrap;
}

.icon-button,
.ghost-button,
.table-button {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 0 12px;
}

.primary-button {
  background: var(--teal);
  border: 1px solid var(--teal);
  color: white;
  padding: 0 16px;
}

.primary-button:hover,
.segmented-control button.active {
  background: var(--teal-dark);
  border-color: var(--teal-dark);
  color: white;
}

.ghost-button:hover,
.icon-button:hover,
.table-button:hover {
  border-color: var(--teal);
  color: var(--teal-dark);
}

.table-button.danger:hover {
  border-color: var(--coral);
  color: var(--coral);
}

.slim {
  min-height: 38px;
}

.summary-grid,
.workspace-grid,
.log-section,
.report-section {
  margin-left: auto;
  margin-right: auto;
  max-width: 1440px;
}

.summary-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 14px;
}

.metric-card,
.entry-form,
.insights-panel,
.log-section,
.report-section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric-card {
  min-height: 128px;
  padding: 18px;
}

.metric-card span {
  color: var(--muted);
  display: block;
  font-size: 0.8rem;
  font-weight: 760;
  margin-bottom: 12px;
}

.metric-card strong {
  color: var(--ink);
  display: block;
  font-size: 2.05rem;
  line-height: 1;
  margin-bottom: 8px;
}

.metric-card p {
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 0;
}

.workspace-grid {
  align-items: start;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(360px, 0.8fr) minmax(0, 1.2fr);
}

.entry-form,
.insights-panel,
.log-section,
.report-section {
  padding: 18px;
}

.entry-form {
  display: grid;
  gap: 14px;
}

.section-heading {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: space-between;
}

.compact-heading {
  margin-bottom: 12px;
}

.segmented-control {
  background: var(--panel-soft);
  border: 1px solid #dce4e6;
  border-radius: 8px;
  display: grid;
  gap: 4px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 4px;
}

.segmented-control button {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  min-width: 0;
  padding: 0 8px;
}

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

label {
  display: grid;
  gap: 7px;
}

.numbers-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-message {
  border-radius: 6px;
  font-size: 0.9rem;
  margin: -2px 0 0;
  padding: 10px 12px;
}

.form-message.success {
  background: rgba(108, 135, 47, 0.13);
  color: #425717;
}

.form-message.error {
  background: rgba(200, 86, 62, 0.13);
  color: #8d321f;
}

.insights-panel {
  display: grid;
  gap: 16px;
}

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

.channel-row {
  align-items: center;
  background: #fbfcfc;
  border: 1px solid #e1e7eb;
  border-radius: 8px;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 14px;
}

.channel-row p,
.theme-row span,
td span {
  color: var(--muted);
  display: block;
  font-size: 0.8rem;
  margin-bottom: 0;
}

.channel-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: end;
}

.channel-stats span,
.status-pill {
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.77rem;
  font-weight: 760;
  min-height: 28px;
  padding: 6px 9px;
}

.channel-stats span {
  background: #edf4f5;
  color: var(--teal-dark);
}

.week-strip {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.day-cell {
  background: #f8fafb;
  border: 1px solid #e2e8ec;
  border-radius: 8px;
  display: grid;
  min-height: 94px;
  padding: 10px;
}

.day-cell span,
.day-cell small {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.day-cell strong {
  align-self: center;
  color: var(--ink);
  font-size: 1.6rem;
  line-height: 1;
}

.theme-panel {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.theme-bars {
  display: grid;
  gap: 12px;
}

.theme-row {
  display: grid;
  gap: 8px;
}

.bar-track {
  background: #e8edf0;
  border-radius: 999px;
  height: 9px;
  overflow: hidden;
}

.bar-track span {
  background: linear-gradient(90deg, var(--teal), var(--green));
  display: block;
  height: 100%;
}

.empty-copy,
.empty-table {
  color: var(--muted);
}

.log-section,
.report-section {
  margin-top: 14px;
}

.filters {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.filters select {
  min-width: 150px;
}

.table-wrap {
  margin-top: 16px;
  overflow-x: auto;
}

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

th,
td {
  border-bottom: 1px solid #e2e8ec;
  font-size: 0.88rem;
  padding: 12px 10px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
}

tbody tr:hover {
  background: #fbfcfc;
}

.status-pill {
  background: #edf1f2;
  color: #4e5b63;
}

.status-pill.sent,
.status-pill.reported {
  background: rgba(108, 135, 47, 0.15);
  color: #425717;
}

.status-pill.awaiting_stats {
  background: rgba(180, 117, 24, 0.16);
  color: #744908;
}

.status-pill.follow_up {
  background: rgba(17, 119, 123, 0.14);
  color: var(--teal-dark);
}

.status-pill.scheduled {
  background: rgba(180, 117, 24, 0.16);
  color: #744908;
}

.status-pill.planned {
  background: rgba(200, 86, 62, 0.14);
  color: #873421;
}

.row-actions {
  display: flex;
  gap: 7px;
}

.table-button {
  min-height: 32px;
  padding: 0 10px;
}

.empty-table {
  padding: 28px 10px;
  text-align: center;
}

.report-box {
  background: #11191f;
  border-color: #11191f;
  color: #eef6f6;
  font-family:
    "SFMono-Regular", Consolas, "Liberation Mono", Menlo, ui-monospace,
    monospace;
  line-height: 1.55;
  margin-top: 16px;
  min-height: 430px;
  white-space: pre;
}

.report-box:focus {
  border-color: var(--teal);
}

@media (max-width: 1100px) {
  .summary-grid,
  .workspace-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .tracker-shell {
    padding: 14px;
  }

  .tracker-header,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .week-control,
  .filters {
    align-items: stretch;
    display: grid;
    grid-template-columns: 1fr;
  }

  .summary-grid,
  .form-grid,
  .numbers-grid,
  .week-strip {
    grid-template-columns: 1fr;
  }

  .channel-row {
    grid-template-columns: 1fr;
  }

  .channel-stats {
    justify-content: start;
  }

  h1 {
    font-size: 2.35rem;
  }
}
