:root {
  color-scheme: light;
  --bg: #f6f7f8;
  --surface: #ffffff;
  --surface-2: #eef4f1;
  --border: #d8dedc;
  --border-strong: #bac6c1;
  --text: #18201d;
  --muted: #68736f;
  --green: #1f7a57;
  --green-dark: #13583d;
  --blue: #2467a6;
  --blue-soft: #dbeafe;
  --amber: #a15c13;
  --amber-soft: #fff3d8;
  --red: #b3323a;
  --red-soft: #fde3e5;
  --shadow: 0 12px 28px rgba(27, 38, 33, 0.08);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-rows: 56px minmax(0, 1fr);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--green);
  font-weight: 800;
}

.brand-title {
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
}

.top-actions {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.account {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--muted);
  font-size: 14px;
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #1f2937;
  color: white;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.icon-button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  display: grid;
  place-items: center;
}

.account-popover {
  position: absolute;
  right: 0;
  top: 42px;
  z-index: 10;
  width: 240px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.account-popover-body {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.menu-item {
  display: block;
  padding: 11px 12px;
  color: var(--text);
  text-decoration: none;
  font-weight: 650;
}

.shell {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
}

.queue {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.queue-head {
  padding: 18px 18px 12px;
  border-bottom: 1px solid var(--border);
}

.queue-title-row,
.task-title-row,
.task-foot {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

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

h1 {
  font-size: 19px;
  line-height: 1.2;
}

.count {
  min-width: 28px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  color: var(--green-dark);
  background: var(--surface-2);
  font-size: 13px;
  font-weight: 700;
}

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

.filters {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 10px;
  border-bottom: 1px solid var(--border);
}

.filter {
  height: 32px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.filter.active {
  background: var(--text);
  color: white;
}

.task-list {
  overflow: auto;
  padding: 8px;
}

.task {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  padding: 12px;
  text-align: left;
  display: grid;
  gap: 8px;
}

.task + .task {
  margin-top: 4px;
}

.task.active {
  background: #f0f6f3;
  border-color: #c9d9d2;
}

.task-title {
  font-size: 14px;
  line-height: 1.25;
  font-weight: 750;
}

.badge {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 750;
}

.badge.approval {
  background: var(--amber-soft);
  color: var(--amber);
}

.task-summary {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.task-foot {
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.empty-list,
.empty-detail {
  padding: 18px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.main {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.detail-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 28px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.detail-title {
  display: grid;
  gap: 8px;
}

.crumbs {
  color: var(--muted);
  font-size: 13px;
}

h2 {
  font-size: 24px;
  line-height: 1.15;
  letter-spacing: 0;
}

.detail-subtitle {
  color: var(--muted);
  line-height: 1.45;
  max-width: 760px;
}

.status-panel {
  flex: 0 0 224px;
  align-self: flex-start;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 8px;
  background: #fbfcfb;
}

.status-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.status-row span:first-child {
  color: var(--muted);
}

.status-row span:last-child {
  font-weight: 700;
  text-align: right;
}

.content {
  overflow: auto;
  padding: 24px 28px 132px;
}

.markdown {
  max-width: 880px;
  display: grid;
  gap: 20px;
}

.markdown h2 {
  font-size: 20px;
}

.markdown h3 {
  margin-top: 4px;
  font-size: 15px;
}

.markdown p,
.markdown li {
  color: #303a36;
  line-height: 1.55;
  font-size: 15px;
}

.markdown ul {
  margin: 0;
  padding-left: 22px;
}

.review-box {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.review-box-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: #fbfcfb;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
}

.review-body {
  padding: 16px;
  display: grid;
  gap: 14px;
}

.field-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.proposed {
  line-height: 1.55;
}

.diff {
  display: grid;
  gap: 8px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 13px;
}

.diff-line {
  border-radius: 6px;
  padding: 7px 9px;
}

.diff-line.old {
  background: var(--red-soft);
  color: var(--red);
}

.diff-line.new {
  background: #ddf5e8;
  color: var(--green-dark);
}

.decision-bar {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: end;
  padding: 14px 28px;
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(14px);
}

.send-back {
  display: grid;
  gap: 6px;
}

.send-back label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

textarea {
  width: 100%;
  min-height: 44px;
  max-height: 112px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  background: var(--surface);
}

.decision-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.button {
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  padding: 0 14px;
  font-weight: 750;
  white-space: nowrap;
}

.button.primary {
  border-color: var(--green);
  background: var(--green);
  color: white;
}

.button.danger {
  border-color: #efb8bd;
  color: var(--red);
}

.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.confirm-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--text);
  color: white;
  box-shadow: var(--shadow);
  font-size: 14px;
}

@media (max-width: 860px) {
  .shell {
    grid-template-columns: 280px minmax(0, 1fr);
  }

  .detail-head {
    display: grid;
    padding: 18px;
  }

  .status-panel {
    width: 100%;
    grid-template-columns: repeat(3, 1fr);
  }

  .status-row {
    display: grid;
    gap: 3px;
  }

  .status-row span:last-child {
    text-align: left;
  }

  .content {
    padding: 18px 18px 150px;
  }

  .decision-bar {
    grid-template-columns: 1fr;
    padding: 12px 18px;
  }

  .decision-actions {
    justify-content: flex-end;
    flex-wrap: wrap;
  }
}

@media (max-width: 700px) {
  .app {
    grid-template-rows: 54px auto;
  }

  .topbar {
    padding: 0 14px;
  }

  .account span {
    display: none;
  }

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

  .queue {
    border-right: 0;
    border-bottom: 1px solid var(--border);
    max-height: 44vh;
  }

  .main {
    min-height: 56vh;
  }
}
