:root {
  --bg: #f8f7f2;
  --surface: #ffffff;
  --text: #1e2b2f;
  --muted: #5b676b;
  --accent: #17646a;
  --accent-soft: #d6ecee;
  --danger: #ad2f2f;
  --border: #d8dddf;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Segoe UI', Tahoma, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top right, #f2f8f8, var(--bg) 45%);
}

.wrapper {
  width: min(1120px, 92vw);
  margin: 0 auto;
}

.site-header {
  background: #0f2629;
  color: #fff;
  border-bottom: 4px solid var(--accent);
}

.header-inner {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.04em;
}

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

.top-nav a,
.link-btn {
  color: #d7f6f8;
  text-decoration: none;
  font-size: 0.95rem;
}

.header-review-btn {
  border: 1px solid #83d6df;
  border-radius: 8px;
  padding: 8px 10px;
  background: transparent;
  color: #e5fdff;
  cursor: pointer;
}

.main-content {
  padding: 24px 0 48px;
}

.main-content-full {
  width: 100%;
  margin: 0;
  padding: 0;
}

.hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: stretch;
}

.hero h1 {
  margin: 0 0 8px;
}

.home-hero-shell {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 16px;
  margin-bottom: 20px;
}

.home-hero-copy,
.home-request-card,
.home-card,
.home-list-head {
  background: linear-gradient(155deg, #ffffff, #f4fbfb);
  border: 1px solid #d4e2e4;
  border-radius: 16px;
}

.home-hero-copy {
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.home-hero-copy::after {
  content: '';
  position: absolute;
  right: -40px;
  top: -30px;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(23, 100, 106, 0.18), rgba(23, 100, 106, 0));
}

.home-badge {
  display: inline-flex;
  margin: 0 0 10px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #e2f4f5;
  color: #0f5b60;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.home-hero-title {
  margin: 0 0 8px;
  font-size: clamp(1.8rem, 4vw, 2.7rem);
  line-height: 1.05;
  font-family: 'Avenir Next', 'Trebuchet MS', sans-serif;
}

.home-hero-text {
  margin: 0 0 14px;
  color: var(--muted);
  max-width: 62ch;
}

.home-request-card {
  padding: 18px;
}

.home-request-card h2 {
  margin: 0 0 8px;
  font-size: 1.26rem;
}

.home-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  margin-bottom: 12px;
}

.home-list-head h2 {
  margin: 0;
  font-size: 1.25rem;
}

.home-filter label {
  gap: 5px;
  margin: 0;
  font-size: 0.9rem;
}

.home-filter select {
  min-width: 210px;
}

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

.home-card {
  padding: 14px;
}

.home-card-top {
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.home-chip {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 8px;
  background: #e8f1f2;
  color: #234247;
  font-weight: 600;
}

.home-card h3 {
  margin: 0 0 10px;
}

.home-card h3 a {
  color: var(--text);
  text-decoration: none;
}

.home-card-description {
  margin: 0 0 10px;
  color: #36494e;
  line-height: 1.38;
}

.home-card-meta {
  margin: 0 0 12px;
  color: var(--muted);
}

.topic-highlight,
.card,
.stat-card,
.table-wrap,
.auth-box,
.research-frame-wrapper,
.comment,
.empty {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
}

.topic-highlight {
  margin: 24px 0;
  border-width: 2px;
  border-color: #87c6cb;
  background: linear-gradient(145deg, #f3fbfc, #ffffff);
}

.muted {
  color: var(--muted);
}

.stat-value {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
}

.filter-form {
  margin: 18px 0;
}

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

.card h3 {
  margin-top: 0;
}

.card h3 a {
  text-decoration: none;
  color: var(--text);
}

.meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.93rem;
}

.grid-form {
  display: grid;
  gap: 12px;
}

.compact-form {
  max-width: 720px;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 600;
  font-size: 0.95rem;
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid #bac5c8;
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

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

button,
.btn {
  display: inline-block;
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
}

button:hover,
.btn:hover {
  filter: brightness(0.95);
}

.secondary-btn {
  background: #2d4f66;
  margin-top: 8px;
}

.danger {
  background: var(--danger);
}

.inline-form {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
}

.inline-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

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

.dashboard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 10px 0 18px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
}

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

.table-text {
  white-space: pre-wrap;
  word-break: break-word;
  min-width: 260px;
}

th {
  font-size: 0.9rem;
  color: var(--muted);
}

.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.admin-nav a {
  color: #0f5f64;
  background: var(--accent-soft);
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 8px;
}

.flash {
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 14px;
}

.flash-success {
  background: #dff7e1;
  border: 1px solid #8bcf90;
}

.flash-error {
  background: #fde2e2;
  border: 1px solid #f0a9a9;
}

.warning {
  background: #fff0d8;
  border: 1px solid #f1cb85;
  border-radius: 8px;
  padding: 10px;
}

.research-frame-wrapper {
  margin: 16px 0 20px;
  padding: 0;
  overflow: hidden;
}

.research-frame {
  width: 100%;
  min-height: 80vh;
  border: none;
  background: #fff;
}

.research-screen {
  height: calc(100vh - 68px);
}

.research-frame-full {
  height: 100%;
  min-height: 100%;
  display: block;
}

.review-modal {
  position: fixed;
  inset: 0;
  z-index: 1500;
  background: rgba(7, 18, 20, 0.55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 86px 14px 18px;
}

.review-modal[hidden] {
  display: none;
}

.review-modal-card {
  width: min(560px, 100%);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
}

.review-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.review-modal-head h2 {
  margin: 0;
}

.close-modal-btn {
  background: #3a4d59;
}

body.modal-open {
  overflow: hidden;
}

.flash-floating {
  position: fixed;
  right: 14px;
  top: 74px;
  z-index: 1700;
  max-width: min(420px, 90vw);
}

.comment-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.comment-meta {
  margin: 0 0 6px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
}

.back-link {
  color: #0f5f64;
  text-decoration: none;
}

@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .inline-fields {
    grid-template-columns: 1fr;
  }

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

  .home-list-head {
    flex-direction: column;
    align-items: stretch;
  }

  .home-filter select {
    min-width: 0;
  }
}
