:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-strong: #fbfcfe;
  --text: #20262f;
  --muted: #6a7382;
  --line: #dfe4ea;
  --blue: #2878b8;
  --blue-dark: #1d5f94;
  --green: #7cc7e8;
  --green-dark: #62b6dc;
  --primary-button: var(--green);
  --primary-button-hover: var(--green-dark);
  --coral: #cc6b4a;
  --shadow: 0 18px 45px rgba(26, 33, 44, 0.09);
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Hiragino Sans",
    "Yu Gothic",
    sans-serif;
}

* {
  box-sizing: border-box;
}

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

button,
input,
select {
  font: inherit;
}

button {
  min-height: 36px;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    transform 0.15s ease;
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

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

.app-shell {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

.topbar {
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 26px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--coral);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.15;
}

h2 {
  font-size: 16px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
}

.group-control {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.group-control select {
  min-height: 34px;
  min-width: 116px;
  padding: 0 32px 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  background: var(--surface-strong);
  outline: none;
}

.group-control select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(40, 120, 184, 0.14);
}

.ghost-link {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  text-decoration: none;
  background: var(--surface-strong);
}

.status {
  min-width: 108px;
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.workspace {
  display: grid;
  flex: 1;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
}

.sidebar {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 14px;
}

.panel,
.content {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel {
  padding: 14px;
}

.member-panel {
  position: relative;
  z-index: 4;
}

.options-panel {
  flex: none;
}

.panel-head,
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.search,
.field input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-strong);
  color: var(--text);
  outline: none;
}

.search {
  padding: 0 12px;
}

.search:focus,
.field input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(40, 120, 184, 0.14);
}

.button-row,
.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-size-control {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.page-size-control select {
  min-height: 36px;
  min-width: 92px;
  padding: 0 32px 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  background: var(--surface-strong);
  outline: none;
}

.page-size-control select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(40, 120, 184, 0.14);
}

.button-row {
  margin: 10px 0;
}

.primary {
  padding: 0 15px;
  color: #ffffff;
  background: var(--primary-button);
  font-weight: 700;
}

.primary:hover:not(:disabled) {
  background: var(--primary-button-hover);
}

.secondary {
  padding: 0 12px;
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--surface-strong);
}

.secondary:hover:not(:disabled) {
  border-color: #b6c2cf;
  background: #eef3f8;
}

.wide {
  width: 100%;
  margin-top: 14px;
}

.member-select {
  position: relative;
  margin-top: 13px;
}

.member-dropdown-button {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px;
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--surface-strong);
  text-align: left;
}

.member-dropdown-button:hover:not(:disabled) {
  border-color: #b6c2cf;
}

.member-dropdown-button:focus,
.member-select.is-open .member-dropdown-button {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(40, 120, 184, 0.14);
  outline: none;
}

.member-dropdown-arrow {
  width: 8px;
  height: 8px;
  flex: none;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-2px) rotate(45deg);
  transition: transform 0.15s ease;
}

.member-select.is-open .member-dropdown-arrow {
  transform: translateY(2px) rotate(225deg);
}

.member-dropdown {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  left: 0;
  z-index: 10;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 18px 45px rgba(26, 33, 44, 0.18);
}

.member-dropdown[hidden] {
  display: none;
}

.member-dropdown-actions {
  display: flex;
  gap: 8px;
  margin: 9px 0;
}

.member-dropdown-actions button {
  flex: 1;
  min-width: 0;
  padding: 0 8px;
  font-size: 13px;
}

.member-list {
  max-height: min(330px, calc(100vh - 280px));
  overflow: auto;
  padding-right: 2px;
  overscroll-behavior: contain;
}

.member-dropdown-close {
  width: 100%;
  margin-top: 9px;
}

.member-empty {
  padding: 22px 8px;
  color: var(--muted);
  text-align: center;
}

.member-item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 8px 7px;
  border-radius: 7px;
}

.member-item:hover {
  background: #f0f5f8;
}

.member-item input,
.blog-check {
  width: 17px;
  height: 17px;
  margin: 2px 0 0;
  accent-color: var(--blue);
}

.member-name {
  display: block;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
}

.member-updated {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.field {
  display: grid;
  gap: 7px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.field input {
  padding: 0 10px;
  color: var(--text);
}

.content {
  display: flex;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
}

.toolbar {
  min-height: 66px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.toolbar > div:first-child {
  min-width: 0;
}

.blog-list-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.blog-ad[hidden] {
  display: none;
}

.blog-ad:has(.adsbygoogle[data-ad-status="filled"]) {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.blog-ad .adsbygoogle[data-ad-status="unfilled"] {
  display: none !important;
}

.empty-state {
  margin: 36px auto;
  max-width: 360px;
  color: var(--muted);
  text-align: center;
}

.blog-list {
  display: grid;
  gap: 0;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.pagination[hidden] {
  display: none;
}

.pagination-pages {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
}

.page-step,
.page-number {
  min-width: 38px;
  padding: 0 11px;
}

.page-number {
  flex: none;
}

.page-number.is-current {
  border-color: var(--blue);
  color: #ffffff;
  background: var(--blue);
}

.blog-item {
  display: grid;
  grid-template-columns: 28px 72px minmax(0, 1fr) 112px;
  gap: 12px;
  align-items: center;
  min-height: 92px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.blog-item:hover {
  background: #f7fafb;
}

.thumb {
  width: 72px;
  height: 72px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #e8eef2;
}

.thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.thumb-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--blue-dark);
  font-weight: 800;
  background: #dcecf7;
}

.blog-main {
  min-width: 0;
}

.blog-title {
  margin: 0 0 6px;
  overflow: hidden;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.blog-link {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--blue-dark);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  background: var(--surface-strong);
}

.blog-link:hover {
  border-color: #b9c9d7;
  background: #eef6fb;
}

.is-loading {
  opacity: 0.65;
  pointer-events: none;
}

.pdf-render-stage {
  position: fixed;
  top: 0;
  left: -100000px;
  width: 190mm;
  background: #ffffff;
  pointer-events: none;
}

.pdf-document {
  width: 190mm;
  padding: 0;
  overflow-wrap: anywhere;
  color: #111111;
  background: #ffffff;
  font-family:
    "Noto Sans CJK JP",
    "Noto Sans JP",
    "MS Gothic",
    "Yu Gothic",
    "Hiragino Sans",
    sans-serif;
  font-size: 14px;
  line-height: 1.8;
}

.pdf-header {
  padding-bottom: 14px;
  border-bottom: 1px solid #cfd5db;
}

.pdf-group {
  margin: 0 0 6px;
  color: #5e6875;
  font-size: 11px;
  font-weight: 700;
}

.pdf-header h1 {
  margin: 0;
  color: #111111;
  font-size: 25px;
  line-height: 1.45;
}

.pdf-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 8px;
  color: #5e6875;
  font-size: 12px;
}

.pdf-article {
  padding-top: 16px;
}

.pdf-article img {
  width: auto !important;
  max-width: 25% !important;
  height: auto !important;
  max-height: 135mm !important;
  object-fit: contain;
  break-inside: avoid;
}

.pdf-article video,
.pdf-article iframe,
.pdf-article script {
  display: none !important;
}

.pdf-article a {
  color: inherit;
  text-decoration: none;
}

.pdf-source {
  display: flex;
  gap: 5px;
  margin-top: 24px;
  padding-top: 10px;
  border-top: 1px solid #cfd5db;
  color: #5e6875;
  font-size: 10px;
  overflow-wrap: anywhere;
}

@media (max-width: 860px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .group-control {
    flex: 1 1 180px;
  }

  .group-control select {
    flex: 1;
  }

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

  .member-panel {
    z-index: 5;
  }

  .toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .page-size-control {
    width: 100%;
  }

  .page-size-control select {
    flex: 1;
  }

  .toolbar-actions button {
    flex: 1 1 130px;
  }

  .pagination {
    align-items: stretch;
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .pagination-pages {
    order: 3;
    width: 100%;
    flex-wrap: nowrap;
  }

  .page-step {
    flex: 1 1 120px;
  }

  .blog-item {
    grid-template-columns: 26px 60px minmax(0, 1fr);
  }

  .thumb {
    width: 60px;
    height: 60px;
  }

  .blog-link {
    grid-column: 3;
    justify-self: start;
    min-width: 92px;
  }
}

@media (max-width: 520px) {
  .topbar,
  .workspace {
    padding: 14px;
  }

  h1 {
    font-size: 22px;
  }

  .blog-title {
    white-space: normal;
  }
}
