:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f6f7f4;
  color: #1d2522;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

.shell {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 28px;
  min-height: 100vh;
  padding: 32px;
}

.entry-panel,
.tools-panel {
  background: #ffffff;
  border: 1px solid #d9dfd6;
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 18px 50px rgba(30, 40, 34, 0.08);
}

.tools-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 24px;
  max-height: calc(100vh - 64px);
  overflow: hidden;
}

.heading {
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 6px;
  color: #597065;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.1;
}

h1 {
  font-size: 34px;
}

h2 {
  margin-top: 4px;
  margin-bottom: 12px;
  font-size: 18px;
}

.tools-panel p {
  margin: 0 0 14px;
  color: #4d5a55;
  line-height: 1.5;
}

.latest-comments-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
}

.latest-comments-list {
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.comment-form {
  display: grid;
  gap: 16px;
}

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

label {
  display: grid;
  gap: 7px;
  color: #33413b;
  font-size: 14px;
  font-weight: 650;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cbd4ce;
  border-radius: 7px;
  padding: 11px 12px;
  color: #1d2522;
  font: inherit;
  background: #fbfcfb;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #2d7a61;
  outline: 3px solid rgba(45, 122, 97, 0.18);
}

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

button,
.bookmarklet {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid #1f6f58;
  border-radius: 7px;
  padding: 0 16px;
  color: #ffffff;
  font: inherit;
  font-weight: 750;
  text-decoration: none;
  background: #24745d;
  cursor: pointer;
}

button.danger,
.danger {
  border-color: #b84635;
  color: #ffffff;
  background: #c64d3b;
}

.admin-body {
  min-height: 100vh;
  background: #f6f7f4;
}

.admin-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.admin-link {
  color: #1f6f58;
  font-weight: 750;
}

.admin-nav {
  display: flex;
  gap: 14px;
  align-items: center;
}

.login-body {
  min-height: 100vh;
  background: #f6f7f4;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(100%, 440px);
  border: 1px solid #d9dfd6;
  border-radius: 8px;
  padding: 28px;
  background: #ffffff;
  box-shadow: 0 18px 50px rgba(30, 40, 34, 0.08);
}

.login-panel h1 {
  margin-bottom: 22px;
}

.admin-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr)) auto auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 12px;
  border: 1px solid #d9dfd6;
  border-radius: 8px;
  padding: 16px;
  background: #ffffff;
}

.admin-comments {
  display: grid;
  gap: 14px;
}

.admin-users-panel {
  margin-top: 28px;
  border: 1px solid #d9dfd6;
  border-radius: 8px;
  padding: 18px;
  background: #ffffff;
}

.section-heading {
  margin-bottom: 14px;
}

.admin-user-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 12px;
}

.admin-users {
  display: grid;
  gap: 10px;
}

.admin-user {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  border: 1px solid #d9dfd6;
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfb;
}

.admin-comment {
  border: 1px solid #d9dfd6;
  border-radius: 8px;
  padding: 16px;
  background: #ffffff;
}

.admin-comment.is-resolved {
  opacity: 0.72;
  background: #f8faf8;
}

.admin-comment-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.admin-meta,
.admin-question,
.admin-resolved {
  color: #596861;
  font-size: 13px;
  line-height: 1.4;
}

.admin-question {
  margin-top: 12px;
}

.admin-comment p {
  margin: 12px 0 0;
  white-space: pre-wrap;
  line-height: 1.5;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.admin-actions button {
  min-height: 34px;
  padding: 0 12px;
}

.review-link {
  margin-top: 18px;
  overflow-wrap: anywhere;
}

.review-link a {
  color: #1f6f58;
  font-weight: 750;
}

.review-body {
  overflow: hidden;
  background: #eef1ed;
}

.review-layout {
  position: relative;
  height: 100vh;
}

.survey-pane {
  width: 100vw;
  height: 100vh;
  background: #ffffff;
}

#survey-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #ffffff;
}

.review-sidebar {
  position: fixed;
  top: 18px;
  right: 18px;
  bottom: 18px;
  z-index: 10;
  width: min(360px, calc(100vw - 36px));
  height: min(760px, calc(100vh - 36px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  max-height: calc(100vh - 36px);
  overflow: hidden;
  border: 1px solid #d9dfd6;
  border-radius: 8px;
  padding: 22px;
  background: #ffffff;
  box-shadow: 0 18px 50px rgba(30, 40, 34, 0.16);
}

.review-sidebar-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  cursor: move;
  user-select: none;
}

.panel-controls {
  display: flex;
  gap: 6px;
}

.panel-controls button {
  width: 30px;
  min-height: 30px;
  padding: 0;
  border-color: #cbd4ce;
  color: #24312c;
  background: #ffffff;
}

.review-sidebar-body {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 14px;
  min-height: 0;
  overflow: hidden;
}

.review-sidebar.is-collapsed {
  bottom: auto;
  height: auto;
  width: 260px;
  grid-template-rows: auto;
  padding: 12px 14px;
}

.review-sidebar.is-collapsed #panel-minimize {
  display: none;
}

.review-sidebar.is-collapsed .review-sidebar-body {
  display: none;
}

.review-sidebar.is-minimized {
  width: 58px;
  height: 58px;
  overflow: hidden;
  padding: 10px;
}

.review-sidebar.is-minimized .review-sidebar-header > div:first-child,
.review-sidebar.is-minimized #panel-collapse,
.review-sidebar.is-minimized .review-sidebar-body {
  display: none;
}

.review-sidebar.is-minimized .review-sidebar-header {
  justify-content: center;
}

.review-sidebar h1 {
  font-size: 28px;
}

.review-sidebar textarea {
  min-height: 130px;
}

.detected-context {
  display: grid;
  gap: 4px;
  border: 1px solid #e0e6e2;
  border-radius: 8px;
  padding: 12px;
  color: #51615a;
  background: #fbfcfb;
  font-size: 12px;
}

.detected-context strong {
  color: #1d2522;
}

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

.missing-survey {
  padding: 32px;
}

button.secondary {
  border-color: #cbd4ce;
  color: #24312c;
  background: #ffffff;
}

.status {
  min-height: 20px;
  margin: 0;
  color: #2d7a61;
  font-weight: 650;
}

.comments {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.comment {
  border: 1px solid #e0e6e2;
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfb;
}

.comment-meta {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  color: #52625b;
  font-size: 13px;
}

.comment p {
  margin: 10px 0;
  line-height: 1.45;
  white-space: pre-wrap;
}

.question-text {
  margin-top: 10px;
  color: #596861;
  font-size: 13px;
  line-height: 1.4;
}

.comment a {
  color: #1f6f58;
  font-weight: 700;
}

.empty {
  color: #68766f;
}

@media (max-width: 850px) {
  .shell {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .tools-panel {
    max-height: 70vh;
  }

  .review-layout {
    height: 100vh;
  }

  .review-sidebar {
    top: auto;
    right: 10px;
    bottom: 10px;
    left: 10px;
    width: auto;
    height: 46vh;
    max-height: 46vh;
  }

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

  .admin-shell {
    padding: 16px;
  }

  .admin-header,
  .admin-comment-top {
    display: grid;
  }

  .admin-filters {
    grid-template-columns: 1fr;
  }

  .admin-actions {
    justify-content: start;
  }
}
