:root {
  --paper: #f7f5f1;
  --paper-line: #e8e3d9;
  --ink: #2b2620;
  --ink-soft: #5c574e;
  --red: #c33b2b;
  --red-soft: #f5e8e6;
  --green: #2e5837;
  --green-soft: #e4ede6;
  --amber: #8a5e12;
  --amber-soft: #f5ecd8;
  --white: #ffffff;
  --viewer-toolbar-latest: #1e3a5f;
  /* Admin screen tokens (direction C: Slate + Indigo) — do not reuse for proof viewer */
  --admin-bg: #f8f9fc;
  --admin-border: #e4e7ec;
  --admin-text: #101828;
  --admin-text-muted: #667085;
  --admin-accent: #4f46e5;
  --admin-accent-hover: #4338ca;
  --admin-accent-soft: #eef2ff;
  --admin-success: #12b76a;
  --admin-warning: #f79009;
  --admin-error: #f04438;
  --admin-error-soft: #fef3f2;
  /* Header-only tokens (used under header via local --ink etc. overrides) */
  --header-bg: var(--ink);
  --header-ink: var(--paper);
  --header-ink-soft: #b9b2a4;
  --header-line: #45403a;
  --header-surface: #383229;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "IBM Plex Sans JP", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.app {
  margin: 0 auto;
  padding: 28px 28px 48px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--paper-line);
  background: var(--header-bg);
  /* Cancel .app padding so the dark band spans the viewport width */
  margin: -28px -28px 0;
  padding: 12px 28px;
  /* Required: body color is already resolved to dark --ink; token override alone does not recolor inherited text */
  color: var(--ink);
  --ink: var(--header-ink);
  --ink-soft: var(--header-ink-soft);
  --paper-line: var(--header-line);
  --white: var(--header-surface);
  --paper: var(--header-surface);
}

header h1 {
  font-size: 18px;
  line-height: 1.25;
  color: var(--ink);
}

header .user-switch label {
  display: none;
}

.global-search {
  position: relative;
  flex: 1 1 240px;
  max-width: 420px;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.global-search input[type="search"] {
  flex: 1;
  min-width: 0;
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 12.5px;
  padding: 7px 10px;
  border: 1px solid var(--paper-line);
  background: var(--paper);
  color: var(--ink);
}

.global-search input[type="search"]:focus {
  outline: 2px solid var(--ink-soft);
  outline-offset: 1px;
}

header .global-search input[type="search"]::placeholder {
  color: var(--ink-soft);
  opacity: 1;
}

.global-search .ghost-btn {
  flex-shrink: 0;
  padding: 6px 10px;
  font-size: 11px;
}

.global-search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 40;
  max-height: min(360px, 50vh);
  overflow: auto;
  background: var(--paper);
  border: 1px solid var(--paper-line);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

/* Float above main pane: restore :root colors (keep in sync with :root) */
header .global-search-results {
  --ink: #2b2620;
  --ink-soft: #5c574e;
  --paper-line: #e8e3d9;
  --white: #ffffff;
  --paper: #f7f5f1;
  background: var(--paper);
}

.global-search-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--paper-line);
  background: transparent;
  cursor: pointer;
  padding: 8px 12px;
  color: var(--ink);
  font-family: "IBM Plex Sans JP", sans-serif;
}

.global-search-item:last-child {
  border-bottom: 0;
}

.global-search-item:hover {
  background: rgba(0, 0, 0, 0.04);
}

.global-search-item.is-active,
.global-search-footer.is-active {
  background: rgba(0, 0, 0, 0.06);
  outline: 1px solid var(--paper-line);
}

.global-search-type {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
}

.global-search-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  min-width: 0;
}

.global-search-breadcrumb {
  font-size: 11px;
  line-height: 1.35;
  color: var(--ink-soft);
  word-break: break-word;
}

.global-search-main,
.global-search-label {
  font-size: 12.5px;
  line-height: 1.35;
  word-break: break-word;
  color: var(--ink);
}

.global-search-item mark {
  background: var(--amber-soft);
  color: var(--ink);
  padding: 0 1px;
}

.global-search-empty {
  padding: 12px;
  font-size: 12px;
  color: var(--ink-soft);
  font-family: "IBM Plex Sans JP", sans-serif;
}

.global-search-footer {
  display: block;
  width: 100%;
  text-align: center;
  border: 0;
  border-top: 1px solid var(--paper-line);
  background: var(--white);
  cursor: pointer;
  padding: 10px 12px;
  color: var(--ink);
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 12px;
  font-weight: 600;
}

.global-search-footer:hover {
  background: rgba(0, 0, 0, 0.04);
}

/* —— 検索結果ページ —— */
.search-results-page {
  max-width: 820px;
}

.search-results-header {
  margin-bottom: 8px;
}

.search-results-title {
  margin: 0 0 12px;
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
}

.search-results-form {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.search-results-form input[type="search"] {
  flex: 1;
  min-width: 0;
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 13px;
  padding: 8px 12px;
  border: 1px solid var(--paper-line);
  background: var(--white);
  color: var(--ink);
}

.search-results-form input[type="search"]:focus {
  outline: 2px solid var(--ink-soft);
  outline-offset: 1px;
}

.search-type-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.search-scope-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.search-scope-select-wrap {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.search-scope-select {
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 12px;
  padding: 5px 8px;
  border: 1px solid var(--paper-line);
  background: var(--white);
  color: var(--ink);
  max-width: min(240px, 50vw);
}

.search-scope-name {
  font-size: 12px;
  color: var(--ink-soft);
  max-width: min(280px, 40vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-biz-filters {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.search-biz-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.search-results-hints {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.search-type-count {
  margin-left: 6px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  opacity: 0.85;
}

.page-filter-chip.active .search-type-count {
  opacity: 1;
}

.search-results-pager {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.search-pager-meta {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  color: var(--ink-soft);
}

.search-results-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.search-results-empty,
.search-results-note {
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 13px;
  color: var(--ink-soft);
  padding: 8px 0;
}

.search-result-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.search-section-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.search-section-title {
  margin: 0;
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.search-section-count {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  color: var(--ink-soft);
}

.search-result-list {
  border: 1px solid var(--paper-line);
  background: var(--white);
}

.search-result-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--paper-line);
  background: transparent;
  cursor: pointer;
  padding: 10px 14px;
  color: var(--ink);
  font-family: "IBM Plex Sans JP", sans-serif;
}

.search-result-item:last-child {
  border-bottom: 0;
}

.search-result-item:hover {
  background: rgba(0, 0, 0, 0.04);
}

.search-result-item mark {
  background: var(--amber-soft);
  color: var(--ink);
  padding: 0 1px;
}

.search-section-more {
  align-self: flex-start;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.header-brand-logo {
  display: block;
  height: 28px;
  width: auto;
  max-width: 120px;
  object-fit: contain;
  flex-shrink: 0;
  /* Optical: JP h1 glyph sits above the line-box center; nudge logo up to match */
  transform: translateY(-5px);
}

.admin-brand-logo-preview {
  display: block;
  height: 48px;
  width: auto;
  max-width: 200px;
  object-fit: contain;
  background: var(--paper);
  border: 1px solid var(--paper-line);
  padding: 6px;
}

.sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: var(--white);
  border: 1px solid var(--paper-line);
  color: var(--ink);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.sidebar-toggle:hover {
  border-color: var(--ink);
}

.app-layout {
  display: flex;
  align-items: stretch;
  flex: 1;
  min-height: 0;
  position: relative;
  /* Cancel .app padding so sidebar/main meet the viewport edges */
  margin: 0 -28px -48px -28px;
}

.sidebar-backdrop {
  display: none;
}

.sidebar {
  width: 220px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border-right: 1px solid var(--paper-line);
  max-height: calc(100vh - 120px);
  position: sticky;
  top: 0;
  align-self: flex-start;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 12px 10px;
  border-bottom: 1px solid var(--paper-line);
}

.sidebar-title {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.sidebar-new-btn {
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 8px;
  background: var(--ink);
  color: var(--white);
  border: 1px solid var(--ink);
  cursor: pointer;
  white-space: nowrap;
}

.sidebar-new-btn:hover {
  background: #3f434c;
}

.sidebar-list {
  overflow-y: auto;
  flex: 1;
  padding: 4px 0;
}

.sidebar-section-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 12px 14px 4px;
}

.sidebar-empty {
  padding: 16px 14px;
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.5;
}

.sidebar-empty-link,
.sidebar-footer-link .ghost-btn {
  margin-top: 10px;
  font-size: 11.5px;
  padding: 6px 10px;
}

.sidebar-footer-link {
  padding: 10px 14px 14px;
  text-align: center;
}

.sidebar-item .pc-title,
.project-card .pc-title {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.sidebar-item .pc-title-text,
.project-card .pc-title-text {
  flex: 1;
  min-width: 0;
}

.proj-fav-btn {
  flex: 0 0 auto;
  appearance: none;
  border: none;
  background: transparent;
  padding: 0 2px;
  margin: 0;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.2;
  color: var(--ink-soft);
}

.proj-fav-btn:hover {
  color: #e2a008;
}

.proj-fav-btn.is-on {
  color: #e2a008;
}

.proj-fav-btn-sidebar {
  font-size: 13px;
}

.sidebar-item {
  padding: 12px 14px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition:
    background 0.15s,
    border-color 0.15s;
}

.sidebar-item:hover {
  background: #f2efe7;
}

.sidebar-item.active {
  background: var(--white);
  border-left-color: var(--ink);
}

.sidebar-item .pc-title {
  font-family: "IBM Plex Sans JP", sans-serif;
  font-weight: 600;
  font-size: 13.5px;
  margin-bottom: 3px;
  line-height: 1.35;
  word-break: break-word;
}

.sidebar-item .pc-companies {
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 11px;
  color: var(--ink-soft);
  margin-bottom: 2px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-unread-badge {
  display: inline-block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  background: var(--red);
  color: #fff;
  border-radius: 10px;
  vertical-align: middle;
  margin-left: 5px;
  line-height: 1.4;
}

.unread-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
  margin-right: 6px;
  vertical-align: middle;
  flex-shrink: 0;
}

.unread-pill {
  display: inline-flex;
  align-items: center;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  vertical-align: middle;
  flex-shrink: 0;
  line-height: 1.4;
}

.unread-summary {
  display: inline;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--red);
  margin-left: 6px;
  vertical-align: middle;
}

.unread-summary-block {
  display: block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  color: var(--red);
  margin-top: 2px;
  line-height: 1.35;
}

.dashboard-tasks-table .my-task-title .unread-dot {
  margin-right: 4px;
}

.dashboard-task-unread-summary {
  margin-left: 0;
  margin-top: 2px;
  margin-bottom: 0;
}

.unread-feed-popover {
  position: absolute;
  z-index: 80;
  min-width: 280px;
  max-width: min(420px, calc(100vw - 24px));
  max-height: 360px;
  overflow: auto;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: 0 8px 28px rgba(20, 20, 20, 0.14);
  border-radius: 8px;
  padding: 8px 0;
}

.unread-feed-popover[hidden] {
  display: none !important;
}

.viewer-markup-filter-popover {
  /* overlay（flex）内でもフローに乗らないよう fixed。Fullscreen 時は overlay 子孫である必要がある */
  position: fixed;
  z-index: 90;
  min-width: 200px;
  max-width: min(280px, calc(100vw - 24px));
  background: var(--paper);
  border: 1px solid var(--paper-line);
  box-shadow: 0 8px 28px rgba(20, 20, 20, 0.14);
  border-radius: 8px;
  padding: 8px 0;
  box-sizing: border-box;
}

.viewer-markup-filter-popover[hidden] {
  display: none !important;
}

.viewer-markup-filter-head {
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-soft);
  padding: 4px 12px 8px;
  border-bottom: 1px solid var(--paper-line);
  margin-bottom: 4px;
}

.viewer-markup-filter-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 8px;
}

.viewer-markup-filter-section.viewer-markup-filter-priorities {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 4px 10px;
  padding: 6px 12px;
}

.viewer-markup-filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 12.5px;
  color: var(--ink);
  padding: 4px 4px;
  cursor: pointer;
  user-select: none;
}

.viewer-markup-filter-row input {
  margin: 0;
  accent-color: var(--ink);
}

.viewer-markup-filter-sep {
  height: 1px;
  background: var(--paper-line);
  margin: 4px 0;
}

.viewer-markup-filter-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  padding: 4px 10px 6px;
}

.viewer-markup-filter-action {
  font-size: 11px;
  padding: 4px 8px;
}

.unread-feed-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-soft);
  padding: 4px 12px 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}

.unread-feed-head-title {
  min-width: 0;
  flex: 1;
}

.unread-feed-head .ghost-btn {
  flex-shrink: 0;
  padding: 4px 8px;
  font-size: 10.5px;
}

.unread-feed-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 8px 12px;
  font-family: "IBM Plex Sans JP", sans-serif;
  color: var(--ink);
}

.unread-feed-item:hover {
  background: var(--paper-2, rgba(0, 0, 0, 0.04));
}

.unread-feed-page {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  font-weight: 600;
  margin-right: 6px;
}

.unread-feed-summary {
  font-size: 12.5px;
}

.unread-feed-time {
  display: block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  color: var(--ink-soft);
  margin-top: 2px;
}

.unread-feed-empty,
.unread-feed-loading {
  padding: 12px;
  font-size: 12.5px;
  color: var(--ink-soft);
}

.unread-feed-more {
  padding: 8px 12px 10px;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--ink-soft);
  border-top: 1px solid var(--paper-line);
}

.sidebar-unread-badge,
.project-unread-badge {
  cursor: pointer;
}

.sidebar-unread-badge:hover,
.project-unread-badge:hover {
  filter: brightness(0.92);
}

.sidebar-item .pc-meta {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  color: var(--ink-soft);
  margin-bottom: 0;
  line-height: 1.4;
}

.sidebar-empty {
  padding: 20px 14px;
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.5;
}

.main-pane {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--white);
  /* Content inset (white surface itself reaches the edges via .app-layout margins) */
  padding: 0 28px 48px 28px;
}

.main-empty {
  margin-top: 48px;
  max-width: 420px;
}

.main-empty-title {
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 8px;
  color: var(--ink);
}

.main-empty-lead {
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.6;
  margin: 0 0 18px;
}

@media (max-width: 900px) {
  .app {
    padding: 20px 16px 40px;
  }

  header {
    flex-wrap: wrap;
    align-items: center;
    margin: -20px -16px 0;
    padding: 10px 16px;
  }

  .impersonation-banner {
    margin: 0 -16px;
    padding: 10px 16px;
  }

  .app-layout {
    margin: 0 -16px -40px -16px;
  }

  .global-search {
    order: 3;
    flex: 1 1 100%;
    max-width: none;
    margin-top: 8px;
  }

  .sidebar-toggle {
    display: flex;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 60;
    width: 260px;
    max-height: none;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 4px 0 24px rgba(44, 46, 51, 0.12);
  }

  .app-layout.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(44, 46, 51, 0.35);
  }

  .app-layout.sidebar-open .sidebar-backdrop {
    display: block;
  }

  .main-pane {
    width: 100%;
    padding: 0 16px 40px 16px;
  }

  #previewOverlay {
    padding: 8px;
  }

  #previewOverlay .viewer-toolbar {
    gap: 8px;
  }

  #previewOverlay .viewer-toolbar .vt-group {
    flex-wrap: wrap;
  }
}

.brand-eyebrow {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
  text-transform: uppercase;
  margin-bottom: 6px;
}

h1 {
  font-family: "IBM Plex Sans JP", sans-serif;
  font-weight: 600;
  font-size: 26px;
  margin: 0;
  letter-spacing: 0.01em;
  cursor: pointer;
}

.user-switch {
  text-align: right;
}

.user-switch label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  color: var(--ink-soft);
  letter-spacing: 0.1em;
  display: block;
  margin-bottom: 4px;
}

select#userSelect {
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 13px;
  padding: 6px 10px;
  background: var(--white);
  border: 1px solid var(--paper-line);
  color: var(--ink);
  cursor: pointer;
}

.user-bar-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.user-bar-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
}

.user-bar-row .ghost-btn {
  font-size: 11.5px;
  padding: 6px 12px;
}

header .user-bar-row .ghost-btn {
  padding: 5px 10px;
  font-size: 11px;
}

header .global-search .ghost-btn {
  padding: 5px 10px;
}

.login-screen {
  min-height: calc(100vh - 72px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px 80px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--white);
  border: 1px solid var(--paper-line);
  padding: 36px 32px 28px;
}

.login-card h2 {
  font-family: "IBM Plex Sans JP", sans-serif;
  font-weight: 600;
  font-size: 24px;
  margin: 0 0 6px;
  letter-spacing: 0.01em;
}

.login-lead {
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 13px;
  color: var(--ink-soft);
  margin: 0 0 22px;
  line-height: 1.6;
}

.login-card .field {
  margin-bottom: 16px;
}

.login-card label {
  display: block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.login-card input[type="email"],
.login-card input[type="password"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--paper-line);
  font-size: 14px;
  font-family: "IBM Plex Sans JP", sans-serif;
  background: var(--paper);
  color: var(--ink);
}

.login-card input[type="email"]:focus,
.login-card input[type="password"]:focus {
  outline: none;
  border-color: var(--ink);
  background: var(--white);
}

.login-error {
  display: none;
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--red);
  background: var(--red-soft);
  color: var(--red);
  font-size: 12.5px;
  font-family: "IBM Plex Sans JP", sans-serif;
}

.login-error.show {
  display: block;
}

.login-actions {
  margin-top: 8px;
}

.login-actions .primary-btn {
  width: 100%;
  padding: 12px 16px;
}

.login-hint {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed var(--paper-line);
  font-size: 11.5px;
  color: var(--ink-soft);
  line-height: 1.55;
}

.login-footer-link {
  margin-top: 16px;
  text-align: center;
  font-size: 12.5px;
}

.login-footer-link a {
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px dotted var(--ink-soft);
  cursor: pointer;
}

.login-footer-link a:hover {
  color: var(--ink);
  border-color: var(--ink);
}

.login-success {
  display: none;
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--green);
  background: var(--green-soft);
  color: var(--green);
  font-size: 12.5px;
  font-family: "IBM Plex Sans JP", sans-serif;
  line-height: 1.5;
}

.login-success.show {
  display: block;
}

.login-panel {
  display: none;
}

.login-panel.active {
  display: block;
}

.login-card input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--paper-line);
  font-size: 14px;
  font-family: "IBM Plex Sans JP", sans-serif;
  background: var(--paper);
  color: var(--ink);
}

.login-card input[type="text"]:focus {
  outline: none;
  border-color: var(--ink);
  background: var(--white);
}

.tabs {
  display: flex;
  gap: 4px;
  margin-top: 10px;
  border-bottom: 1px solid var(--paper-line);
}

.tab {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11.5px;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  padding: 8px 14px;
  cursor: pointer;
  border-radius: 6px 6px 0 0;
  text-decoration: none;
}

.tab:hover {
  color: var(--ink);
}

.tab.active {
  color: var(--ink);
  background: var(--paper);
  font-weight: 600;
  border-bottom: 1px solid var(--ink);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11.5px;
  color: var(--ink-soft);
  margin: 20px 0 14px;
}

/* display:flex が [hidden] を打ち消すため明示 */
.breadcrumb[hidden] {
  display: none;
}

.breadcrumb a {
  color: var(--ink-soft);
  cursor: pointer;
  text-decoration: none;
  border-bottom: 1px dotted var(--ink-soft);
}

.breadcrumb a:hover {
  color: var(--ink);
  border-color: var(--ink);
}

.breadcrumb .current {
  color: var(--ink);
  font-weight: 500;
}

.breadcrumb .sep {
  color: var(--ink-soft);
}

.impersonation-banner {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 -28px;
  padding: 10px 28px;
  background: var(--amber-soft);
  border-bottom: 1px solid var(--paper-line);
  color: var(--ink);
}

.impersonation-banner.is-active {
  display: flex;
}

.impersonation-banner-text {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  line-height: 1.45;
}

.impersonation-banner-text strong {
  display: inline;
  margin-right: 8px;
  color: var(--amber);
  font-weight: 700;
}

.impersonation-banner-text span {
  color: var(--ink-soft);
}

.impersonation-stop-btn {
  flex-shrink: 0;
  font-family: "IBM Plex Sans JP", sans-serif;
  font-weight: 600;
  font-size: 13px;
  background: var(--ink);
  color: var(--paper);
  border: none;
  padding: 8px 14px;
  cursor: pointer;
  white-space: nowrap;
}

.impersonation-stop-btn:hover {
  background: #1f1b17;
}

#updateBanner {
  display: none;
  position: relative;
  margin: 16px 0 18px;
  padding: 14px 18px;
  background: var(--white);
  border: 1.5px dashed var(--red);
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

#updateBanner.show {
  display: flex;
}

.stamp {
  font-family: "IBM Plex Sans JP", sans-serif;
  font-weight: 700;
  color: var(--red);
  border: 2.5px solid var(--red);
  border-radius: 50%;
  width: 46px;
  height: 46px;
  min-width: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transform: rotate(-8deg);
  letter-spacing: -1px;
}

.banner-text {
  flex: 1;
}

.banner-text strong {
  display: block;
  font-size: 14px;
  margin-bottom: 2px;
}

.banner-text span {
  font-size: 12px;
  color: var(--ink-soft);
  font-family: "IBM Plex Mono", monospace;
}

.reload-btn {
  font-family: "IBM Plex Sans JP", sans-serif;
  font-weight: 600;
  font-size: 13px;
  background: var(--red);
  color: var(--white);
  border: none;
  padding: 10px 18px;
  cursor: pointer;
  white-space: nowrap;
}

.reload-btn:hover {
  background: #a52f21;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 22px 0 10px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  color: var(--ink-soft);
  letter-spacing: 0.06em;
}

.toolbar-right {
  display: flex;
  gap: 8px;
}

.proj-toolbar {
  flex-wrap: wrap;
  gap: 10px 16px;
}

.proj-toolbar-info {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.proj-toolbar-fetched {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.proj-toolbar-members {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.proj-toolbar-member {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.proj-toolbar-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--paper);
  border: 1px solid var(--paper-line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--ink);
  font-family: "IBM Plex Sans JP", sans-serif;
  flex-shrink: 0;
}

.proj-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.proj-toolbar-ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.proj-toolbar-primary-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--ink);
  color: var(--white);
  border: 1px solid var(--ink);
}

.proj-toolbar-primary-btn:hover {
  background: #3f434c;
}

.proj-toolbar-more {
  position: relative;
}

.proj-toolbar-more-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
}

.proj-toolbar-more-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 80;
  min-width: 240px;
  max-width: min(320px, calc(100vw - 24px));
  padding: 6px 0;
  background: var(--white);
  border: 1px solid var(--paper-line);
  box-shadow: 0 8px 28px rgba(20, 20, 20, 0.14);
  border-radius: 8px;
  box-sizing: border-box;
}

.proj-toolbar-more-menu[hidden] {
  display: none !important;
}

.proj-toolbar-more-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin: 0;
  padding: 9px 14px;
  border: none;
  background: transparent;
  color: var(--ink);
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 13px;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
  box-sizing: border-box;
}

.proj-toolbar-more-item:hover {
  background: var(--paper);
}

.proj-toolbar-more-item.is-danger {
  color: var(--red);
}

.proj-toolbar-more-item.is-danger:hover {
  background: var(--red-soft);
}

.proj-toolbar-more-sep {
  height: 1px;
  margin: 6px 0;
  background: var(--paper-line);
}

.proj-toolbar-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.proj-supplement {
  margin: -4px 0 12px;
}

.proj-supplement-triggers {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: var(--ink-soft);
}

.proj-supplement-trigger {
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 12px;
  color: var(--ink-soft);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.proj-supplement-trigger:hover {
  color: var(--ink);
}

.proj-supplement-sep {
  color: var(--paper-line);
  font-size: 11px;
  user-select: none;
}

.proj-supplement-panel {
  display: none;
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--paper);
  border: 1px solid var(--paper-line);
  font-size: 13px;
  color: var(--ink);
}

.proj-supplement-panel.open {
  display: block;
}

.proj-supplement-desc {
  line-height: 1.6;
  white-space: normal;
}

.proj-supplement-files {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sim-btn,
.primary-btn,
.ghost-btn {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  padding: 7px 12px;
  cursor: pointer;
}

.sim-btn {
  background: transparent;
  border: 1px solid var(--ink-soft);
  color: var(--ink-soft);
}

.sim-btn:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.primary-btn {
  background: var(--ink);
  color: var(--white);
  border: 1px solid var(--ink);
  font-family: "IBM Plex Sans JP", sans-serif;
  font-weight: 600;
  font-size: 12.5px;
  padding: 9px 16px;
}

.primary-btn:hover {
  background: #3f434c;
}

.ghost-btn {
  background: transparent;
  border: 1px solid var(--paper-line);
  color: var(--ink);
  font-family: "IBM Plex Sans JP", sans-serif;
  font-weight: 600;
  font-size: 12.5px;
  padding: 9px 16px;
}

.ghost-btn:hover {
  background: var(--white);
  border-color: var(--ink);
}

.danger-btn {
  background: transparent;
  border: 1px solid var(--red);
  color: var(--red);
  font-family: "IBM Plex Sans JP", sans-serif;
  font-weight: 600;
  font-size: 12.5px;
  padding: 9px 16px;
  cursor: pointer;
}

.danger-btn:hover {
  background: var(--red);
  color: var(--white);
}

.projects-list-table tbody tr {
  cursor: pointer;
}

.projects-list-table .projects-list-fav {
  width: 2.5rem;
  vertical-align: middle;
}

.projects-list-table .projects-list-name .item-name {
  font-weight: 600;
}

.projects-list-table .projects-list-company {
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-soft);
}

.projects-list-table .projects-list-due {
  white-space: nowrap;
}

.projects-list-table .projects-list-status {
  vertical-align: middle;
}

.projects-list-table
  .projects-list-due
  .project-due-badge
  + .project-due-badge {
  margin-left: 4px;
}

.projects-list-table .projects-list-unread:empty::before,
.projects-list-table .projects-list-due:empty::before {
  content: none;
}

.projects-list-unread-empty {
  color: var(--paper-line);
}

.project-due-badge {
  display: inline-block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  border: 1px solid;
  vertical-align: middle;
  line-height: 1.4;
  white-space: nowrap;
}

.project-due-badge.project-due-overdue {
  color: var(--red);
  background: var(--red-soft);
  border-color: var(--red);
}

.project-due-badge.project-due-soon {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: var(--amber);
}

.proj-fav-btn-table {
  font-size: 13px;
}

.sidebar-item .pc-meta .issue-breakdown {
  font-size: inherit;
}

.projects-list-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin: 0 0 16px;
}

.projects-list-toolbar .page-filter-label {
  margin: 0;
}

.projects-list-toolbar .user-filter-select {
  min-width: 200px;
  max-width: min(360px, 100%);
}

.projects-list-toolbar .projects-list-search {
  min-width: 220px;
  max-width: min(360px, 100%);
  cursor: text;
}

.projects-list-toolbar .projects-list-create {
  margin-left: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
}

thead th {
  text-align: left;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  text-transform: uppercase;
  padding: 10px 12px;
  border-bottom: 1px solid var(--paper-line);
}

tbody tr {
  border-bottom: 1px solid var(--paper-line);
  transition: background 0.15s ease;
  cursor: pointer;
}

tbody tr:hover {
  background: #eef0f3;
}

tbody tr.just-updated {
  animation: flash 1.6s ease;
}

@keyframes flash {
  0% {
    background: var(--amber-soft);
  }

  100% {
    background: transparent;
  }
}

td {
  padding: 12px;
  font-size: 13.5px;
  vertical-align: middle;
}

.page-no {
  font-family: "IBM Plex Mono", monospace;
  font-weight: 500;
  color: var(--ink-soft);
  font-size: 12px;
}

.page-no .page-approval-badge {
  margin-left: 8px;
  vertical-align: middle;
  font-family: "IBM Plex Sans JP", sans-serif;
}

.page-list-actions-cell {
  text-align: right;
  white-space: nowrap;
}

.page-list-actions .user-pw-btn,
.page-list-actions .member-remove-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 6px;
  line-height: 1;
}

.page-list-actions .user-pw-btn svg,
.page-list-actions .member-remove-btn svg {
  width: 14px;
  height: 14px;
  display: block;
}

.page-list-thumb-th {
  text-align: center;
}

.page-list-thumb-cell {
  width: 72px;
  padding-top: 8px;
  padding-bottom: 8px;
  vertical-align: middle;
  text-align: center;
}

.page-list-thumb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 2px;
  line-height: 0;
}

.page-list-thumb-btn:hover .page-list-thumb,
.page-list-thumb-btn:focus-visible .page-list-thumb {
  border-color: var(--ink);
}

.page-list-thumb-btn:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.page-list-thumb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: var(--white);
  border: 1px solid var(--paper-line);
  overflow: hidden;
  flex-shrink: 0;
  box-sizing: border-box;
}

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

/* PDF生成完了時に applyPdfThumbnailToDom が差し込む .attach-thumb を一覧サイズに収める */
.page-list-thumb .attach-thumb {
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
}

.page-list-thumb-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: var(--ink-soft);
}

.page-list-thumb-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.page-list-thumb-empty {
  font-size: 10px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--ink-soft);
  background: var(--paper);
  text-align: center;
  padding: 0 2px;
  user-select: none;
}

.page-list-actions .member-remove-btn {
  color: var(--ink-soft);
  background: var(--paper);
  border-color: var(--paper-line);
}

.page-list-actions .member-remove-btn:hover {
  color: #b91c1c;
  border-color: #f1a8a8;
  background: #fef2f2;
}

.item-name {
  font-weight: 500;
}

.item-note {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 2px;
}

.avatar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
}

.avatar .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink-soft);
  flex-shrink: 0;
}

.assignee-control {
  max-width: 100%;
  white-space: nowrap;
  flex-shrink: 0;
}

.assignee-control-label {
  font-size: 12px;
  color: var(--ink-soft);
  white-space: nowrap;
  margin-right: 2px;
}

.assignee-inline-select {
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 12px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--paper-line);
  padding: 2px 6px;
  max-width: 140px;
  cursor: pointer;
}

.assignee-inline-select:hover,
.assignee-inline-select:focus {
  border-color: var(--ink);
  outline: none;
}

.assignee-defaults {
  font-size: 11px;
  color: var(--ink-soft);
  line-height: 1.45;
  margin-top: 4px;
}

.comment-count {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  color: var(--ink-soft);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.comment-count svg {
  width: 12px;
  height: 12px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 9px 3px 7px;
  border-radius: 4px;
  border: 1px solid transparent;
  white-space: nowrap;
  line-height: 1.3;
}

.status-chip svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.status-chip.done {
  color: var(--green);
  border-color: var(--green);
  background: var(--green-soft);
}

.status-chip.fix {
  color: var(--red);
  border-color: var(--red);
  background: var(--red-soft);
}

.status-chip.review {
  color: var(--amber);
  border-color: var(--amber);
  background: var(--amber-soft);
}

.issue-breakdown {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11.5px;
  color: var(--ink-soft);
  line-height: 1.45;
}

.issue-breakdown .ib-part {
  white-space: nowrap;
}

.issue-breakdown .ib-open {
  color: var(--red);
}

.issue-breakdown .ib-review {
  color: var(--amber);
}

.issue-breakdown .ib-done {
  color: var(--green);
}

.issue-breakdown .ib-sep {
  color: var(--paper-line);
  margin: 0 4px;
}

.page-status-minibar {
  display: flex;
  width: 100%;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--paper-line);
}

.psmb-seg-fix,
.psmb-seg-review,
.psmb-seg-done {
  height: 100%;
  flex: 0 0 auto;
}

.psmb-seg-fix {
  background: var(--red);
}

.psmb-seg-review {
  background: var(--amber);
}

.psmb-seg-done {
  background: var(--green);
}

.pis-status-counts {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
}

.pis-status-counts button.ib-part {
  appearance: none;
  margin: 0;
  padding: 1px 2px;
  border: none;
  border-radius: 3px;
  background: transparent;
  font: inherit;
  font-family: "IBM Plex Mono", monospace;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
}

.pis-status-counts button.ib-part:hover {
  text-decoration-color: currentColor;
  background: color-mix(in srgb, currentColor 8%, transparent);
}

.pis-status-counts button.ib-part.is-active {
  font-weight: 700;
  text-decoration-color: currentColor;
  box-shadow: inset 0 -2px 0 currentColor;
}

.pis-status-counts .ib-part.is-disabled {
  opacity: 0.4;
  cursor: default;
}

.page-issue-summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.page-issue-summary .pis-counts {
  line-height: 1.4;
}

.page-issue-summary .pis-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.page-issue-summary .pis-list .status-chip {
  align-self: flex-start;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  cursor: pointer;
  text-align: left;
  font: inherit;
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.3;
}

.page-issue-summary .pis-list .status-chip:hover {
  filter: brightness(0.96);
}

.page-issue-summary .pis-list .status-chip.active {
  box-shadow: 0 0 0 2px currentColor;
}

.page-issue-summary .pis-empty {
  font-size: 12.5px;
  color: var(--ink-soft);
}

.page-issue-summary .pis-done-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: none;
  background: none;
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 12.5px;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  align-self: flex-start;
}

.page-issue-summary .pis-done-toggle:hover {
  color: var(--ink-soft);
}

.page-issue-summary .pis-done-toggle .pis-caret {
  display: inline-block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  text-decoration: none;
  color: var(--ink-soft);
  width: 1em;
}

.page-issue-summary .pis-done-panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.page-issue-summary .pis-done-panel[hidden] {
  display: none;
}

.org-badge {
  display: inline-block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  padding: 4px 10px;
  border: 1px solid var(--paper-line);
  color: var(--ink-soft);
  background: var(--paper);
}

.org-badge.client {
  border-color: var(--ink-soft);
  color: var(--ink);
}

.attach {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px dotted var(--ink-soft);
  cursor: pointer;
}

.attach svg {
  width: 12px;
  height: 12px;
}

.no-attach {
  color: var(--ink-soft);
  font-size: 12px;
}

.timestamp {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11.5px;
  color: var(--ink-soft);
}

.detail-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 24px;
  margin-top: 18px;
  align-items: start;
}

.detail-grid-proof {
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, 1fr);
}

.detail-work-surface {
  min-width: 0;
}

.detail-proof-rail {
  min-width: 0;
  padding: 18px 16px;
}

.proof-rail-title {
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 12px;
  color: var(--ink);
}

.proof-rail-section {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--paper-line);
}

.proof-rail-section.proof-rail-latest {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.proof-rail-section-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 8px;
}

.proof-rail-upload-btn {
  margin-bottom: 10px;
  font-size: 11.5px;
  padding: 7px 12px;
}

.proof-rail-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.proof-rail-actions + .proof-rail-fold {
  margin-top: 10px;
}

.proof-rail-preview-btn {
  font-size: 12.5px;
  padding: 8px 14px;
}

.proof-rail-delete-ver {
  margin-left: auto;
  font-size: 11px;
  padding: 5px 10px;
}

.proof-rail-fold-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.proof-rail-fold-caret {
  display: inline-block;
  width: 1em;
  color: var(--ink-soft);
  font-weight: 400;
}

.proof-rail-fold-body {
  margin-top: 10px;
}

.proof-rail-danger .proof-rail-fold-toggle {
  color: var(--red);
}

.page-detail-filter-slot {
  margin-top: 10px;
  margin-bottom: 2px;
}

.page-detail-filter-slot .page-list-controls {
  margin-bottom: 0;
}

.page-issue-summary.is-compact {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.detail-card {
  background: var(--white);
  border: 1px solid var(--paper-line);
  padding: 24px;
}

.detail-card h2 {
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 21px;
  font-weight: 600;
  margin: 0 0 4px;
}

.page-chrome-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 4px;
}

.page-chrome-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
  min-width: 0;
  flex: 1 1 auto;
}

.page-chrome-title h2 {
  margin: 0;
}

.page-chrome-title .status-chip {
  flex-shrink: 0;
}

.page-share-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 6px;
  line-height: 1;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--paper-line);
  cursor: pointer;
}

.page-share-btn:hover {
  border-color: var(--ink);
  background: var(--white);
}

.page-share-btn svg {
  width: 16px;
  height: 16px;
  display: block;
}

.page-approval-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 8px 0 4px;
}

.page-approval-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 4px;
  border: 1px solid transparent;
  white-space: nowrap;
  line-height: 1.3;
}

.page-approval-badge.is-approved {
  color: var(--green);
  border-color: var(--green);
  background: var(--green-soft);
}

.page-approval-badge.is-changes-requested {
  color: var(--red);
  border-color: var(--red);
  background: var(--red-soft);
}

.page-approval-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.page-approval-actions .primary-btn,
.page-approval-actions .ghost-btn {
  font-size: 11.5px;
  padding: 5px 10px;
}

.share-links-heading {
  margin: 18px 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.share-link-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--paper-line);
}

.share-link-meta {
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.5;
}

.share-link-created {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--paper-line);
}

.share-link-created-row {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.share-link-created-row input[type="text"] {
  flex: 1;
  min-width: 0;
}

.guest-body {
  background: var(--paper);
  color: var(--ink);
}

.guest-body .login-screen {
  min-height: 100vh;
}

.guest-app {
  max-width: 920px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--white);
  border-left: 1px solid var(--paper-line);
  border-right: 1px solid var(--paper-line);
}

/* Guest page has a <header> but must not inherit the app header dark band.
   Restore :root tokens (keep in sync with :root). */
.guest-body header.guest-header {
  margin: 0;
  padding: 20px 24px 16px;
  justify-content: flex-start;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  --ink: #2b2620;
  --ink-soft: #5c574e;
  --paper-line: #e8e3d9;
  --white: #ffffff;
  --paper: #f7f5f1;
  background: var(--paper);
  color: var(--ink);
  border-bottom: 1px solid var(--paper-line);
}

.guest-header h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
  color: var(--ink);
}

.guest-lead {
  margin: 0;
  font-size: 13px;
  color: var(--ink-soft);
}

.guest-main {
  padding: 20px 24px 48px;
  background: var(--white);
}

.guest-section {
  margin-bottom: 28px;
}

.guest-section h2 {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.guest-preview img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--paper-line);
}

.guest-pdf {
  width: 100%;
  min-height: 70vh;
  border: 1px solid var(--paper-line);
  background: var(--paper);
}

.guest-preview-caption {
  margin-top: 8px;
  font-size: 12px;
  color: var(--ink-soft);
}

.guest-checklist {
  list-style: none;
  margin: 0;
  padding: 0;
}

.guest-checklist li {
  padding: 10px 0;
  border-bottom: 1px solid var(--paper-line);
}

.guest-item-title {
  font-weight: 600;
  color: var(--ink);
}

.guest-item-meta,
.guest-item-note {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.5;
}

.guest-comment-form {
  margin-top: 16px;
}

.guest-form-error {
  margin: 8px 0;
  font-size: 12.5px;
  color: var(--red);
}

.detail-tab-panel {
  display: none;
  margin-top: 12px;
}

.detail-tab-panel.active {
  display: block;
}

.thread-scroll {
  max-height: min(90vh, 1680px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--paper-line);
  background: var(--paper);
}

.thread-comments {
  flex: 1 0 auto;
  padding: 14px 14px 16px;
  background: var(--paper);
}

.thread-comments .detail-sub {
  margin-bottom: 0;
}

.thread-comments .comment .c-text {
  background: var(--white);
  border: 1px solid var(--paper-line);
}

.thread-comments .comment.system-comment .c-text {
  background: #eef0f3;
  border: none;
  border-left: 3px solid #d1d5db;
}

.detail-sub {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 18px;
}

.detail-sub.has-unread-panel {
  margin-bottom: 8px;
}

.page-unread-panel {
  border: 1px solid var(--paper-line);
  background: var(--red-soft);
  padding: 8px 10px;
  margin-bottom: 16px;
}

.page-unread-panel-head {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--red);
  margin-bottom: 6px;
}

.page-unread-panel-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.page-unread-panel-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: var(--white);
  padding: 7px 10px;
  cursor: pointer;
  color: var(--ink);
  font: inherit;
}

.page-unread-panel-item:hover {
  border-color: var(--red);
}

.page-unread-panel-item-title {
  display: block;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}

.page-unread-panel-item-summary {
  display: block;
  margin-top: 2px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  color: var(--red);
  line-height: 1.35;
}

.page-unread-panel-item-cta {
  display: block;
  margin-top: 2px;
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
  line-height: 1.35;
}

.detail-field {
  margin-bottom: 16px;
}

.detail-field label {
  display: block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.detail-field .val {
  font-size: 14px;
}

.status-picker {
  display: flex;
  gap: 8px;
}

.status-picker .status-chip {
  cursor: pointer;
  opacity: 0.45;
}

.status-picker .status-chip.active {
  opacity: 1;
}

.checklist {
  margin-top: 8px;
}

.check-item {
  border: 1px solid var(--paper-line);
  background: var(--white);
  padding: 10px 12px;
  margin-bottom: 8px;
}

.check-item.is-selected {
  border-color: var(--ink);
  background: var(--paper);
}

/* 自分の担当 × 要対応/確認中のみ強調（対応済みは通常表示） */
.check-item.is-mine-active {
  border-color: var(--paper-line);
  border-left: 3px solid var(--ink);
  background: var(--paper);
  padding-left: 11px;
}

.check-item.is-mine-active.is-selected {
  border-color: var(--ink);
}

/* 未読指摘: 面の色差でスキャン（左帯は担当・優先度と役割分担） */
.check-item.has-unread {
  background: var(--red-soft);
}

.check-item.has-unread .check-item-title-text {
  font-weight: 600;
}

.check-item.is-mine-active.has-unread {
  background: var(--red-soft);
}

.check-item.is-selected.has-unread {
  border-color: var(--ink);
  background: var(--red-soft);
}

.check-item-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.check-item-head-main {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.check-item-select {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
  cursor: pointer;
}

.check-item-select input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--ink);
  cursor: pointer;
}

.checklist-bulk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin: 0 0 10px;
  padding: 8px 10px;
  border: 1px solid var(--paper-line);
  background: var(--paper);
}

.checklist-bulk-bar-count {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  margin-right: 2px;
}

.checklist-bulk-bar select {
  font: inherit;
  font-size: 12.5px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--paper-line);
  padding: 4px 8px;
  min-height: 30px;
}

.checklist-bulk-bar select:disabled,
.checklist-bulk-bar .ghost-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.checklist-bulk-bar .ghost-btn {
  font-size: 12.5px;
  padding: 4px 10px;
  min-height: 30px;
}

.check-item-title {
  font-weight: 500;
  font-size: 13.5px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.check-item-title-text {
  font-weight: 500;
}

.check-item-edit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--paper-line);
  background: var(--paper);
  color: var(--ink-soft);
  cursor: pointer;
  flex-shrink: 0;
}

.check-item-edit-btn:hover {
  color: var(--ink);
  border-color: var(--ink-soft);
}

.check-item-edit-btn.is-danger:hover {
  color: #b91c1c;
  border-color: #f1a8a8;
  background: #fef2f2;
}

.check-item-edit-btn svg {
  width: 12px;
  height: 12px;
  display: block;
}

.check-item-title-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.check-item-edit-form {
  margin-top: 2px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 100%;
}

.check-item-edit-form label {
  display: block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.check-item-edit-priority-label {
  display: block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.check-item-edit-form .priority-radio-group {
  margin-top: 2px;
}

.check-item-edit-form input[type="text"],
.check-item-edit-form textarea {
  width: 100%;
  box-sizing: border-box;
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 13px;
  padding: 7px 9px;
  border: 1px solid var(--paper-line);
  background: var(--paper);
  color: var(--ink);
  resize: vertical;
}

.check-item-edit-form input[type="text"]:focus,
.check-item-edit-form textarea:focus {
  outline: none;
  border-color: var(--ink);
}

.check-item-edit-form textarea {
  min-height: 56px;
}

.check-item-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.check-item-edit-actions .ghost-btn,
.check-item-edit-actions .primary-btn {
  margin-top: 0;
  padding: 5px 11px;
  font-size: 12px;
}

.check-item-note {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 2px;
}

.check-item-audit {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  color: var(--ink-soft);
  margin-top: 4px;
  letter-spacing: 0.01em;
  line-height: 1.45;
}

.check-item-meta {
  display: flex;
  gap: 14px;
  row-gap: 8px;
  align-items: center;
  margin-top: 9px;
  flex-wrap: wrap;
}

@media (max-width: 560px) {
  .check-item-meta {
    flex-direction: column;
    align-items: flex-start;
  }
}

.due-date-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  padding: 2px 7px;
  border: 1px solid;
  cursor: pointer;
  vertical-align: middle;
  line-height: 1.4;
}

.due-date-badge .due-date-edit-icon {
  opacity: 0;
  font-size: 11px;
  line-height: 1;
  margin-left: 2px;
  transition: opacity 0.15s ease;
}

.due-date-badge:hover .due-date-edit-icon,
.due-date-badge:focus .due-date-edit-icon {
  opacity: 0.85;
}

.due-date-overdue {
  color: var(--red);
  background: var(--red-soft);
  border-color: var(--red);
}

.due-date-soon {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: var(--amber);
}

.due-date-normal,
.due-date-done {
  color: var(--ink-soft);
  background: var(--paper);
  border-color: var(--paper-line);
}

.due-date-done {
  opacity: 0.85;
}

.due-date-unset {
  color: var(--ink-soft);
  background: transparent;
  border-color: var(--paper-line);
  border-style: dashed;
}

.due-date-input {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  padding: 1px 4px;
  border: 1px solid var(--paper-line);
  background: var(--white);
  color: var(--ink);
}

.due-date-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  vertical-align: middle;
}

.due-date-clear-btn {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  padding: 1px 6px;
  border: 1px solid var(--paper-line);
  background: var(--paper);
  color: var(--ink-soft);
  cursor: pointer;
}

.due-date-clear-btn[hidden] {
  display: none !important;
}

.app-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(12px);
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 200px;
  max-width: min(420px, calc(100% - 32px));
  padding: 10px 16px;
  background: var(--ink);
  color: #fff;
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(44, 46, 51, 0.22);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
}

.app-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.app-toast.is-error {
  background: #b91c1c;
}

.app-toast .toast-message {
  flex: 1;
  min-width: 0;
}

.app-toast .toast-action {
  flex-shrink: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.app-toast .toast-action:hover,
.app-toast .toast-action:focus-visible {
  opacity: 0.85;
}

#previewOverlay .anno-detail-due {
  margin-bottom: 12px;
}

#previewOverlay .anno-detail-due .anno-compose-label {
  margin-bottom: 4px;
}

.dashboard-wrap {
  padding: 20px 0 24px;
}

.dashboard-section {
  margin-bottom: 0;
  padding-top: 4px;
}

.dashboard-section + .dashboard-section {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--paper-line);
}

.dashboard-section-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
}

.dashboard-section-title {
  margin: 0;
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
}

.dashboard-section-count {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-soft);
}

.dashboard-section-lead {
  font-size: 12px;
  color: var(--ink-soft);
  margin: 0 0 10px;
  line-height: 1.45;
}

.dashboard-section-empty {
  padding: 4px 0 2px;
}

.dashboard-empty-msg {
  margin: 0 0 4px;
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  line-height: 1.45;
}

.dashboard-empty-hint {
  margin: 0;
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.5;
  opacity: 0.85;
}

.dashboard-tasks-table {
  margin-top: 4px;
}

.dashboard-tasks-table tbody tr {
  cursor: pointer;
}

.dashboard-tasks-table .my-task-project {
  font-weight: 500;
}

.dashboard-tasks-table .my-task-title .item-name {
  font-weight: 500;
}

.dashboard-task-due {
  display: inline-block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  font-weight: 600;
  padding: 3px 8px;
  border: 1px solid transparent;
  border-radius: 4px;
  white-space: nowrap;
}

.dashboard-task-due.overdue {
  color: var(--red);
  background: var(--red-soft);
  border-color: transparent;
}

.dashboard-task-due.soon {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: transparent;
}

.dashboard-task-due.later,
.dashboard-task-due.none {
  color: var(--ink-soft);
  background: transparent;
  border-color: transparent;
  font-weight: 500;
  padding-left: 0;
  padding-right: 0;
}

.issue-comment-link {
  display: inline-block;
  margin-top: 8px;
  margin-right: 12px;
  padding: 0;
  border: none;
  background: none;
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 12px;
  color: var(--ink-soft);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.issue-comment-link:hover {
  color: var(--ink);
}

.issue-comment-link.has-comments {
  color: var(--ink);
  font-weight: 500;
}

.thread-system-log-toggle {
  display: inline-block;
  margin: 2px 0 10px 26px;
  padding: 0;
  border: none;
  background: none;
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 12px;
  color: var(--ink-soft);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.thread-system-log-toggle:hover {
  color: var(--ink);
}

.checklist-filter-clear-link {
  display: block;
  margin-top: 6px;
  margin-right: 0;
}

.thread-issue-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  padding: 8px 10px;
  background: var(--amber-soft);
  border: 1px solid var(--amber);
  font-size: 12.5px;
  color: var(--ink);
}

.thread-issue-filter-bar button {
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border: 1px solid var(--paper-line);
  background: var(--white);
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
}

.thread-issue-filter-bar button:hover {
  border-color: var(--ink);
}

.thread-issue-card-wrap {
  margin: 2px 0 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--paper-line);
}

.thread-issue-card-wrap .check-item {
  margin-bottom: 0;
}

.thread-issue-card-wrap .thread-issue-card-clear {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.thread-issue-card-wrap .thread-issue-card-clear button {
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  min-height: 28px;
  border: 1px solid var(--paper-line);
  background: var(--white);
  color: var(--ink-soft);
  cursor: pointer;
  white-space: nowrap;
}

.thread-issue-card-wrap .thread-issue-card-clear button:hover {
  border-color: var(--ink);
  color: var(--ink);
}

@media (max-width: 900px) {
  .thread-issue-card-wrap .check-item-title-actions {
    gap: 6px;
  }

  .thread-issue-card-wrap .check-item-edit-btn {
    width: 28px;
    height: 28px;
  }

  .thread-issue-card-wrap .item-status-picker {
    width: 100%;
  }
}

.thread-issue-select-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 10px 0 12px;
}

.thread-issue-select-row label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  white-space: nowrap;
}

.thread-issue-select-row select {
  flex: 1 1 220px;
  min-width: 0;
  max-width: 100%;
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 13px;
  padding: 6px 8px;
  border: 1px solid var(--paper-line);
  background: var(--white);
  color: var(--ink);
}

.thread-issue-select-row select:focus {
  outline: none;
  border-color: var(--ink);
}

.thread-issue-select-row.is-filter-flash select {
  border-color: var(--amber);
  box-shadow: 0 0 0 2px var(--amber-soft);
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.comment.comment-issue-focus .c-text {
  box-shadow: inset 3px 0 0 var(--amber);
  background: var(--amber-soft);
}

.comment.is-issue-focus .c-text {
  box-shadow: inset 3px 0 0 var(--amber);
  background: var(--amber-soft);
}

.comment.is-search-landing .c-text {
  box-shadow: inset 3px 0 0 var(--amber);
  background: var(--amber-soft);
  animation: search-landing-flash 0.85s ease-in-out 2;
}

.check-item.check-item-focus,
.check-item.is-issue-focus {
  box-shadow: inset 3px 0 0 var(--amber);
  background: var(--amber-soft);
  border-color: var(--amber);
  transition:
    background 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
  animation: search-landing-flash 0.85s ease-in-out 2;
}

.check-item.is-issue-focus.has-unread {
  background: var(--amber-soft);
}

@keyframes search-landing-flash {
  0%,
  100% {
    background: var(--amber-soft);
  }

  45% {
    background: #f5e6b8;
  }
}

.comment.is-search-landing .c-text mark,
.check-item.is-issue-focus mark {
  background: #e5c45c;
  color: var(--ink);
  padding: 0 1px;
  border-radius: 2px;
}

.issue-focus-badge {
  display: inline-block;
  flex-shrink: 0;
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--amber);
  background: var(--white);
  border: 1px solid var(--amber);
  border-radius: 3px;
  padding: 1px 6px;
  line-height: 1.5;
}

.item-status-picker {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  border-left: 1px solid var(--paper-line);
  padding-left: 10px;
}

.item-status-picker .status-chip {
  cursor: pointer;
  opacity: 0.42;
  font-size: 10.5px;
  padding: 3px 7px 3px 5px;
}

.item-status-picker .status-chip svg {
  width: 11px;
  height: 11px;
}

.item-status-picker .status-chip.active {
  opacity: 1;
}

.resolve-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.resolve-tag {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  color: var(--ink-soft);
  border: 1px solid var(--paper-line);
  padding: 1px 6px;
  display: inline-block;
}

.comment-issue-tag {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  color: var(--ink-soft);
  margin-bottom: 4px;
}

.comment-issue-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.comment-issue-row .comment-issue-tag {
  margin-bottom: 0;
}

.comment-issue-edit-link {
  padding: 0;
  border: none;
  background: none;
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 11.5px;
  color: var(--ink-soft);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.comment-issue-edit-link:hover {
  color: var(--ink);
}

.comment-issue-edit {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.comment-issue-edit .assign-select {
  max-width: 220px;
  font-size: 12px;
  padding: 4px 6px;
}

.comment-issue-edit-cancel {
  padding: 0;
  border: none;
  background: none;
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 11.5px;
  color: var(--ink-soft);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.comment-issue-edit-cancel:hover {
  color: var(--ink);
}

.subview-toggle {
  display: flex;
  gap: 20px;
  margin: 16px 0 20px;
  border-bottom: 1px solid var(--paper-line);
}

.subtab {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12.5px;
  letter-spacing: 0.02em;
  padding: 9px 2px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
}

.subtab:hover {
  color: var(--ink);
}

.subtab.active {
  border-bottom-color: var(--ink);
  color: var(--ink);
  font-weight: 600;
  background: transparent;
}

.page-list-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 16px 0 18px;
}

.page-list-controls.checklist-list-controls {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.page-filter-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
}

.checklist-list-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.checklist-list-meta-row .page-list-meta {
  margin-left: 0;
}

.page-filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.page-filter-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  margin-right: 4px;
}

.page-filter-chip {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--paper-line);
  background: var(--white);
  color: var(--ink-soft);
  cursor: pointer;
}

.page-filter-chip:hover {
  color: var(--ink);
  border-color: var(--ink);
}

.page-filter-chip.active {
  border-color: var(--ink);
  color: var(--white);
  font-weight: 600;
  background: var(--ink);
}

.checklist-sort-select {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  padding: 5px 8px;
  border: 1px solid var(--paper-line);
  background: var(--white);
  color: var(--ink);
  cursor: pointer;
}

.page-filter-chip.priority-high.active {
  border-color: #c0392b;
  color: #fff;
  background: #e74c3c;
}

.page-filter-chip.priority-medium.active {
  border-color: #d68910;
  color: #fff;
  background: #f39c12;
}

.page-filter-chip.priority-low.active {
  border-color: #2980b9;
  color: #fff;
  background: #3498db;
}

.thread-assignee-filter {
  margin: 0 0 10px;
}

.thread-assignee-filter .page-filter-chip.active {
  border-color: #ea580c;
  color: #9a3412;
  background: #fff7ed;
}

.user-filter-select {
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 13px;
  padding: 5px 8px;
  border: 1px solid var(--paper-line);
  background: var(--white);
  color: var(--ink);
  min-width: 140px;
  max-width: 220px;
}

.user-filter-select:focus {
  outline: none;
  border-color: var(--ink);
}

.page-list-meta {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  color: var(--ink-soft);
}

th.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

th.sortable:hover {
  color: var(--ink);
}

th.sortable .sort-ind {
  font-size: 10px;
  margin-left: 4px;
  color: var(--ink-soft);
}

.attach-box {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  border: 1px solid #d4cbb8;
  border-left: 3px solid var(--ink);
  padding: 12px;
  cursor: pointer;
  background: var(--amber-soft);
  transition:
    background 0.15s,
    border-color 0.15s;
}

.attach-box:hover {
  border-color: var(--ink);
  border-left-color: var(--ink);
  background: #f0e4cc;
}

.attach-box .attach-thumb {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  max-height: 168px;
}

.attach-box .attach-thumb img {
  object-fit: contain;
  background: var(--white);
}

.attach-box .attach-icon {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  max-height: 168px;
}

.attach-box .attach-info {
  min-width: 0;
}

.attach-icon {
  width: 38px;
  height: 38px;
  background: var(--white);
  border: 1px solid var(--paper-line);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.attach-icon svg {
  width: 18px;
  height: 18px;
  color: var(--ink-soft);
}

.attach-thumb {
  width: 64px;
  height: 64px;
  background: var(--white);
  border: 1px solid var(--paper-line);
  overflow: hidden;
  flex-shrink: 0;
}

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

.attach-info .fname {
  font-size: 13px;
  font-weight: 500;
}

.attach-box .attach-info .fname {
  word-break: break-word;
}

.attach-info .ftype {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  color: var(--ink-soft);
}

.v-badge {
  display: inline-block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  color: var(--ink-soft);
  border: 1px solid var(--paper-line);
  padding: 1px 5px;
  margin-left: 6px;
  vertical-align: middle;
}

.version-readonly-tag {
  display: inline-block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  color: #7a6a2a;
  background: #f5efd6;
  border: 1px solid #e0d4a8;
  padding: 1px 5px;
  vertical-align: middle;
  white-space: nowrap;
}

.version-history {
  margin-top: 10px;
  border-top: 1px dashed var(--paper-line);
  padding-top: 10px;
}

.version-history-title {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  color: var(--ink-soft);
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.version-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 4px;
  cursor: pointer;
  font-size: 12.5px;
}

.version-row:hover {
  background: var(--paper);
}

.version-name {
  flex: 1;
  color: var(--ink-soft);
}

.version-meta {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  color: var(--ink-soft);
  white-space: nowrap;
}

.comments-title {
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 14px;
}

.comment {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  position: relative;
}

.c-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--paper);
  border: 1px solid var(--paper-line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}

.c-body {
  flex: 1;
  min-width: 0;
  position: relative;
}

.c-actions {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  gap: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
  z-index: 1;
}

.comment:hover .c-actions,
.comment:focus-within .c-actions,
.comment.is-editing .c-actions {
  opacity: 1;
  pointer-events: auto;
}

.comment.is-editing .c-actions {
  display: none;
}

.c-action-btn {
  padding: 2px 8px;
  border: 1px solid var(--paper-line);
  border-radius: 3px;
  background: var(--white);
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 11px;
  color: var(--ink-soft);
  cursor: pointer;
  line-height: 1.4;
}

.c-action-btn:hover {
  color: var(--ink);
  border-color: var(--ink-soft);
}

.c-action-btn.c-action-delete:hover {
  color: #a33;
  border-color: #c99;
}

.c-edited-badge {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  color: var(--ink-soft);
  margin-left: 2px;
  cursor: default;
}

.c-text-edit {
  margin-top: 2px;
}

.c-text-edit-input {
  width: 100%;
  box-sizing: border-box;
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 13px;
  line-height: 1.6;
  padding: 10px 12px;
  border: 1px solid var(--paper-line);
  background: var(--paper);
  resize: vertical;
  min-height: 72px;
}

.c-text-edit-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  align-items: center;
}

.comment.is-deleted .c-text-deleted,
.c-text.c-text-deleted {
  color: var(--ink-soft);
  font-style: italic;
  background: transparent;
  padding: 6px 0;
  opacity: 0.75;
}

.comment.is-deleted {
  opacity: 0.85;
}

.c-head {
  display: flex;
  gap: 8px;
  align-items: baseline;
  margin-bottom: 3px;
  padding-right: 72px;
  flex-wrap: wrap;
}

.c-name {
  font-size: 12.5px;
  font-weight: 600;
}

.c-time {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  color: var(--ink-soft);
}

.c-text {
  font-size: 13px;
  line-height: 1.6;
  background: var(--paper);
  padding: 10px 12px;
}

.comment-form {
  margin-top: 20px;
  border-top: 1px solid var(--paper-line);
  padding-top: 16px;
  position: relative;
}

.thread-scroll .comment-form {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin-top: 0;
  flex-shrink: 0;
  padding: 0;
  border-top: 1px solid var(--paper-line);
  background: var(--white);
  box-shadow: 0 -6px 14px -12px rgba(44, 46, 51, 0.14);
}

.comment-form-collapsed {
  padding: 10px 14px;
}

.comment-form-collapsed[hidden] {
  display: none;
}

.comment-compose-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 9px 12px;
  border: 1px dashed var(--paper-line);
  background: var(--paper);
  color: var(--ink-soft);
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition:
    color 0.15s ease,
    border-color 0.15s ease,
    background 0.15s ease;
}

.comment-compose-trigger:hover {
  color: var(--ink);
  border-color: #c5cad3;
  background: #eef0f3;
}

.comment-form-body {
  padding: 12px 14px 14px;
}

.comment-form-body[hidden] {
  display: none;
}

.comment-form-body .notify-targets {
  margin-bottom: 8px;
}

.comment-form-body .notify-targets-summary-text {
  font-size: 12px;
}

.comment-form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.comment-form-actions .primary-btn,
.comment-form-actions .ghost-btn {
  margin-top: 0;
}

.comment-form textarea {
  width: 100%;
  min-height: 56px;
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 13px;
  padding: 9px 10px;
  border: 1px solid var(--paper-line);
  resize: vertical;
  background: var(--white);
  color: var(--ink);
}

.comment-form textarea:focus {
  outline: none;
  border-color: #9ca3af;
}

.comment-form .file-input-row {
  margin-top: 6px;
}

.comment-form .file-uploader-preview {
  margin-top: 8px;
}

.comment-form .primary-btn {
  margin-top: 8px;
}

.mention-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.notify-targets {
  margin-bottom: 10px;
}

.notify-targets-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 4px;
}

.notify-targets-summary-text {
  font-size: 12.5px;
  color: var(--ink-soft);
}

.notify-targets-toggle {
  padding: 0;
  border: none;
  background: none;
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 12.5px;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.notify-targets-toggle:hover {
  color: var(--ink-soft);
}

.notify-targets-panel {
  padding-top: 2px;
}

.notify-targets-panel[hidden],
.notify-targets-summary[hidden] {
  display: none;
}

.notify-targets-panel .notify-targets-toggle {
  margin-top: 2px;
  margin-bottom: 4px;
}

.mention-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  color: var(--ink-soft);
  letter-spacing: 0.06em;
  margin-right: 2px;
}

.mention-chip {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11.5px;
  background: var(--white);
  border: 1.4px solid var(--paper-line);
  color: var(--ink-soft);
  padding: 4px 9px;
  cursor: pointer;
  opacity: 0.5;
}

.mention-chip:hover {
  border-color: var(--ink);
}

.mention-chip.on {
  background: var(--paper);
  border-color: var(--ink);
  color: var(--ink);
  opacity: 1;
  font-weight: 600;
}

.mention-hint {
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 11.5px;
  color: var(--ink-soft);
  margin: -4px 0 10px;
}

.mention {
  color: var(--red);
  font-weight: 600;
  background: var(--red-soft);
  padding: 1px 3px;
}

.c-notify-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 2px;
  padding: 1px 5px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  line-height: 1.2;
  vertical-align: baseline;
}

.c-notify-badge:hover,
.c-notify-badge:focus-visible,
.c-notify-badge.is-open {
  background: var(--paper);
  color: var(--ink);
  outline: none;
}

.c-notify-badge svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.c-notify-count {
  font-variant-numeric: tabular-nums;
}

.c-notify-tooltip {
  position: fixed;
  z-index: 60;
  min-width: 160px;
  max-width: min(280px, calc(100vw - 24px));
  max-height: 200px;
  overflow-x: hidden;
  overflow-y: auto;
  margin: 0;
  padding: 8px 10px;
  list-style: none;
  background: var(--ink);
  color: #fff;
  border-radius: 6px;
  box-shadow: 0 6px 18px rgba(35, 40, 58, 0.22);
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 11.5px;
  line-height: 1.45;
  text-align: left;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: none;
  transition:
    opacity 0.12s ease,
    visibility 0.12s ease;
}

.c-notify-tooltip::before {
  content: "";
  position: absolute;
  top: -4px;
  left: var(--arrow-left, 50%);
  width: 8px;
  height: 8px;
  background: var(--ink);
  transform: translateX(-50%) rotate(45deg);
}

.c-notify-tooltip.is-flipped::before {
  top: auto;
  bottom: -4px;
}

.c-notify-tooltip li {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.c-notify-tooltip li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.c-notify-tooltip li:first-child {
  padding-top: 0;
}

.c-notify-tip-name {
  font-weight: 600;
  color: #fff;
}

.c-notify-tip-email {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  color: rgba(255, 255, 255, 0.72);
  word-break: break-all;
}

@media (hover: hover) and (pointer: fine) {
  .c-notify-badge:hover .c-notify-tooltip,
  .c-notify-badge:focus-within .c-notify-tooltip {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
  }
}

.c-notify-badge.is-open .c-notify-tooltip {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(35, 40, 58, 0.55);
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}

.overlay.show {
  display: flex;
}

#previewOverlay {
  z-index: 70;
  padding: 6px;
  align-items: center;
  justify-content: center;
}

/* 全画面表示時: 余白・角丸を消し、モーダルを画面いっぱいに */
#previewOverlay:fullscreen,
#previewOverlay:-webkit-full-screen {
  padding: 0;
  background: #000;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
}
#previewOverlay:fullscreen .preview-modal,
#previewOverlay:-webkit-full-screen .preview-modal {
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  max-height: 100vh;
  border-radius: 0;
}
#previewOverlay:fullscreen .preview-close-btn,
#previewOverlay:-webkit-full-screen .preview-close-btn {
  z-index: 3;
}
#previewOverlay:fullscreen .viewer-attach-nav,
#previewOverlay:-webkit-full-screen .viewer-attach-nav {
  z-index: 3;
}

#previewOverlay .preview-modal {
  position: relative;
  width: 97vw;
  max-width: 97vw;
  height: calc(100vh - 12px);
  max-height: calc(100vh - 12px);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#previewOverlay .preview-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#previewOverlay .viewer-frame {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#previewOverlay .viewer-toolbar {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0;
  padding: 0;
}

#previewOverlay .viewer-toolbar-row {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 6px 12px;
  box-sizing: border-box;
}

#previewOverlay .viewer-toolbar-primary {
  gap: 14px;
  /* 右上の閉じるボタンと重ならない余白 */
  padding-right: 54px;
}

#previewOverlay .viewer-toolbar-secondary {
  justify-content: space-between;
  gap: 16px;
  min-height: 40px;
  padding-top: 5px;
  padding-bottom: 5px;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.14);
}

#previewOverlay .viewer-toolbar-secondary:not(:has(.vt-group)) {
  display: none;
}

#previewOverlay .viewer-preview-title-group {
  flex: 1 1 240px;
  min-width: 0;
  max-width: none;
  padding-right: 12px;
  border-right: 1px solid rgba(255, 255, 255, 0.2);
  gap: 8px;
}

#previewOverlay .viewer-toolbar .viewer-preview-title {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0.85;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.9);
}

#previewOverlay .viewer-goto-latest-btn {
  flex: 0 0 auto;
  background: #d6e4f5;
  border-color: #d6e4f5;
  color: var(--viewer-toolbar-latest);
  font-weight: 600;
}

#previewOverlay .viewer-goto-latest-btn:hover {
  background: var(--white);
  border-color: var(--white);
  color: var(--viewer-toolbar-latest);
}

#previewOverlay .viewer-view-controls,
#previewOverlay .viewer-utility-controls,
#previewOverlay .viewer-annotation-controls,
#previewOverlay .viewer-filter-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

#previewOverlay .viewer-view-controls {
  flex: 0 0 auto;
}

#previewOverlay .viewer-utility-controls {
  flex: 0 0 auto;
  margin-left: auto;
  padding-left: 4px;
}

#previewOverlay .viewer-annotation-controls {
  flex: 1 1 auto;
  overflow-x: auto;
  scrollbar-width: thin;
}

#previewOverlay .viewer-filter-controls {
  flex: 0 0 auto;
  margin-left: auto;
  padding-left: 14px;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
}

#previewOverlay .viewer-toolbar .vt-group {
  flex-wrap: nowrap;
  flex-shrink: 0;
}

#previewOverlay .viewer-toolbar .vt-group + .vt-group {
  position: relative;
}

#previewOverlay .viewer-toolbar .viewer-btn,
#previewOverlay .viewer-toolbar .page-filter-chip {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

#previewOverlay .viewer-toolbar .viewer-icon-btn {
  width: 30px;
  padding-right: 0;
  padding-left: 0;
  font-size: 14px;
}

#previewOverlay .viewer-toolbar .viewer-page {
  min-width: 48px;
  padding: 0 4px;
  text-align: center;
  white-space: nowrap;
}

#previewOverlay .viewer-toolbar .viewer-anno-nav-caption {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  line-height: 1;
  color: rgba(255, 255, 255, 0.78);
  white-space: nowrap;
  user-select: none;
}

#previewOverlay .viewer-toolbar .viewer-zoom-label {
  min-width: 48px;
  padding-left: 6px;
  padding-right: 6px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

#previewOverlay .viewer-toolbar .page-filter-chip {
  font-size: 11px;
  padding: 5px 10px;
  white-space: nowrap;
  align-self: center;
}

@media (max-width: 980px) {
  #previewOverlay .viewer-toolbar-primary {
    flex-wrap: wrap;
    gap: 6px 10px;
  }

  #previewOverlay .viewer-preview-title-group {
    flex: 1 1 calc(100% - 42px);
    max-width: calc(100% - 42px);
    border-right: 0;
  }

  #previewOverlay .viewer-view-controls {
    order: 2;
  }

  #previewOverlay .viewer-utility-controls {
    order: 3;
  }

  #previewOverlay .viewer-toolbar-secondary {
    align-items: stretch;
    flex-direction: column;
    gap: 6px;
  }

  #previewOverlay .viewer-filter-controls {
    width: 100%;
    margin-left: 0;
    padding: 6px 0 0;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    border-left: 0;
    overflow-x: auto;
  }
}

#previewOverlay .viewer-canvas {
  height: auto;
  flex: 1 1 auto;
  min-height: 180px;
  position: relative;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#previewOverlay .viewer-canvas.is-pannable {
  cursor: grab;
}

#previewOverlay .viewer-canvas.is-panning {
  cursor: grabbing;
}

#previewOverlay .viewer-zoom-target {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: center center;
  will-change: transform;
}

#previewOverlay .viewer-zoom-target > img,
#previewOverlay .viewer-media-stage > img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  pointer-events: none;
  -webkit-user-drag: none;
  user-select: none;
}

#previewOverlay .viewer-zoom-target > .viewer-pdf-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 親（zoom-target / pdf-wrap）の確定サイズを引き継ぎ、img の max-height:100% を解決可能にする */
#previewOverlay .viewer-media-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  min-width: 0;
  min-height: 0;
  line-height: 0;
}

#previewOverlay .viewer-zoom-target > canvas.viewer-pdf-canvas,
#previewOverlay .viewer-pdf-wrap > canvas.viewer-pdf-canvas,
#previewOverlay .viewer-media-stage > canvas.viewer-pdf-canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  border: none;
  pointer-events: none;
  box-shadow: 0 1px 4px rgba(44, 46, 51, 0.12);
}

#previewOverlay .viewer-media-stage > img {
  display: block;
}

/* バージョン差分ハイライト（注釈レイヤの下・クリック透過） */
#previewOverlay .viewer-diff-layer {
  position: absolute;
  left: 0;
  top: 0;
  overflow: visible;
  pointer-events: none;
  z-index: 0;
}

#previewOverlay .viewer-diff-layer .viewer-diff-spotlight {
  pointer-events: none;
}

#previewOverlay .viewer-diff-layer .viewer-diff-rect-tint {
  fill: rgba(195, 59, 43, 0.14);
  stroke: none;
}

#previewOverlay .viewer-diff-layer .viewer-diff-rect-fill {
  stroke: none;
}

#previewOverlay .viewer-diff-layer .viewer-diff-rect-halo {
  fill: none;
  stroke: var(--white);
  stroke-width: 4;
  vector-effect: non-scaling-stroke;
}

#previewOverlay .viewer-diff-layer .viewer-diff-rect {
  fill: none;
  stroke: var(--red);
  stroke-width: 2.5;
  vector-effect: non-scaling-stroke;
}

#previewOverlay
  .viewer-diff-layer
  .viewer-diff-item.is-focused
  .viewer-diff-rect-tint {
  fill: rgba(195, 59, 43, 0.22);
}

#previewOverlay
  .viewer-diff-layer
  .viewer-diff-item.is-focused
  .viewer-diff-rect-halo {
  stroke-width: 5;
}

#previewOverlay
  .viewer-diff-layer
  .viewer-diff-item.is-focused
  .viewer-diff-rect {
  stroke-width: 3.5;
}

#previewOverlay .viewer-diff-layer .viewer-diff-item.is-dimmed {
  opacity: 0.28;
}

#previewOverlay .viewer-diff-layer .viewer-diff-badge-bg {
  fill: var(--red);
  stroke: var(--white);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

#previewOverlay .viewer-diff-layer .viewer-diff-badge-text {
  fill: var(--white);
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 11px;
  font-weight: 700;
  pointer-events: none;
}

#previewOverlay
  .viewer-diff-layer
  .viewer-diff-item.is-dimmed
  .viewer-diff-badge-bg {
  fill: rgba(195, 59, 43, 0.55);
}

@keyframes viewer-diff-attention {
  0%,
  100% {
    opacity: 1;
  }
  30% {
    opacity: 0.35;
  }
  55% {
    opacity: 1;
  }
  78% {
    opacity: 0.5;
  }
}

#previewOverlay .viewer-diff-layer .viewer-diff-item.is-pulsing .viewer-diff-rect-tint,
#previewOverlay .viewer-diff-layer .viewer-diff-item.is-pulsing .viewer-diff-rect-fill,
#previewOverlay .viewer-diff-layer .viewer-diff-item.is-pulsing .viewer-diff-rect-halo,
#previewOverlay .viewer-diff-layer .viewer-diff-item.is-pulsing .viewer-diff-rect,
#previewOverlay .viewer-diff-layer .viewer-diff-item.is-pulsing .viewer-diff-badge-bg,
#previewOverlay .viewer-diff-layer .viewer-diff-item.is-pulsing .viewer-diff-badge-text {
  animation: viewer-diff-attention 0.75s ease-in-out 1;
}

@media (prefers-reduced-motion: reduce) {
  #previewOverlay .viewer-diff-layer .viewer-diff-item.is-pulsing .viewer-diff-rect-tint,
  #previewOverlay .viewer-diff-layer .viewer-diff-item.is-pulsing .viewer-diff-rect-fill,
  #previewOverlay .viewer-diff-layer .viewer-diff-item.is-pulsing .viewer-diff-rect-halo,
  #previewOverlay .viewer-diff-layer .viewer-diff-item.is-pulsing .viewer-diff-rect,
  #previewOverlay .viewer-diff-layer .viewer-diff-item.is-pulsing .viewer-diff-badge-bg,
  #previewOverlay .viewer-diff-layer .viewer-diff-item.is-pulsing .viewer-diff-badge-text {
    animation: none;
  }
}

.viewer-diff-toggle-group {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
}

.viewer-diff-compare-group {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
}

.viewer-diff-compare-select {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: var(--white);
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  padding: 3px 6px;
  max-width: 120px;
  border-radius: 4px;
}

.viewer-diff-compare-select:hover,
.viewer-diff-compare-select:focus {
  border-color: var(--white);
  outline: none;
}

.viewer-diff-status {
  font-size: 11px;
  color: var(--ink-soft);
  line-height: 1.3;
  max-width: 160px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#previewOverlay .viewer-annotation-layer.is-diff-focus-dim .anno {
  opacity: 0.3;
}

/* 位置・サイズは renderAnnotationOverlay がメディア要素基準で px 指定する */
#previewOverlay .viewer-annotation-layer {
  position: absolute;
  left: 0;
  top: 0;
  overflow: visible;
  pointer-events: none;
  z-index: 1;
}

#previewOverlay .viewer-annotation-layer.is-draw-mode {
  pointer-events: auto;
  cursor: crosshair;
}

/* 描画ツール別カーソル（data-anno-tool は updateAnnoLayerMode が付与） */
#previewOverlay .viewer-annotation-layer.is-draw-mode[data-anno-tool="pin"],
#previewOverlay .viewer-canvas.is-anno-drawing[data-anno-tool="pin"] {
  cursor: cell;
}

#previewOverlay .viewer-annotation-layer.is-draw-mode[data-anno-tool="rect"],
#previewOverlay .viewer-annotation-layer.is-draw-mode[data-anno-tool="circle"],
#previewOverlay .viewer-annotation-layer.is-draw-mode[data-anno-tool="arrow"],
#previewOverlay .viewer-canvas.is-anno-drawing[data-anno-tool="rect"],
#previewOverlay .viewer-canvas.is-anno-drawing[data-anno-tool="circle"],
#previewOverlay .viewer-canvas.is-anno-drawing[data-anno-tool="arrow"] {
  cursor: crosshair;
}

#previewOverlay
  .viewer-annotation-layer.is-draw-mode[data-anno-tool="freehand"],
#previewOverlay .viewer-canvas.is-anno-drawing[data-anno-tool="freehand"] {
  cursor: crosshair;
}

#previewOverlay .viewer-annotation-layer .anno {
  pointer-events: auto;
  cursor: pointer;
}

#previewOverlay .viewer-annotation-layer.is-draw-mode .anno {
  pointer-events: none;
  cursor: inherit;
}

#previewOverlay .viewer-annotation-layer .anno-done {
  opacity: 0.38;
}

#previewOverlay .viewer-annotation-layer .anno-done.anno-hide-completed {
  display: none;
}

#previewOverlay .viewer-annotation-layer .anno-carried {
  opacity: 0.55;
}

#previewOverlay
  .viewer-annotation-layer
  .anno-carried:not(.anno-done)
  circle:not(.anno-hit),
#previewOverlay
  .viewer-annotation-layer
  .anno-carried:not(.anno-done)
  rect:not(.anno-hit),
#previewOverlay
  .viewer-annotation-layer
  .anno-carried:not(.anno-done)
  ellipse:not(.anno-hit),
#previewOverlay
  .viewer-annotation-layer
  .anno-carried:not(.anno-done)
  line:not(.anno-hit),
#previewOverlay
  .viewer-annotation-layer
  .anno-carried:not(.anno-done)
  polyline:not(.anno-hit) {
  stroke-dasharray: 5 4;
}

#previewOverlay .viewer-annotation-layer .anno-carried polygon {
  fill-opacity: 0.55;
}

#previewOverlay .viewer-annotation-layer .anno-selected {
  filter: drop-shadow(0 0 2px var(--ink)) drop-shadow(0 0 1px #fff);
}

@keyframes anno-locate-pulse {
  0%,
  100% {
    filter: none;
  }
  35%,
  65% {
    filter: drop-shadow(0 0 7px rgba(37, 99, 235, 0.95))
      drop-shadow(0 0 2px #fff);
  }
}

/* ビューアオープン直後: 全マークを短く点滅させて位置を知らせる */
#previewOverlay .viewer-annotation-layer.is-locate-pulse .anno {
  animation: anno-locate-pulse 0.7s ease-in-out 2;
}

#previewOverlay
  .viewer-annotation-layer.is-locate-pulse
  .anno:not(.anno-done)
  circle:not(.anno-hit),
#previewOverlay
  .viewer-annotation-layer.is-locate-pulse
  .anno:not(.anno-done)
  rect:not(.anno-hit),
#previewOverlay
  .viewer-annotation-layer.is-locate-pulse
  .anno:not(.anno-done)
  ellipse:not(.anno-hit),
#previewOverlay
  .viewer-annotation-layer.is-locate-pulse
  .anno:not(.anno-done)
  line:not(.anno-hit),
#previewOverlay
  .viewer-annotation-layer.is-locate-pulse
  .anno:not(.anno-done)
  polyline:not(.anno-hit) {
  stroke-width: 3.5;
}

#previewOverlay .viewer-annotation-layer .anno.anno-locate-flash {
  animation: anno-locate-pulse 0.7s ease-in-out 2;
}

#previewOverlay
  .viewer-annotation-layer
  .anno.anno-locate-flash:not(.anno-done)
  circle:not(.anno-hit),
#previewOverlay
  .viewer-annotation-layer
  .anno.anno-locate-flash:not(.anno-done)
  rect:not(.anno-hit),
#previewOverlay
  .viewer-annotation-layer
  .anno.anno-locate-flash:not(.anno-done)
  ellipse:not(.anno-hit),
#previewOverlay
  .viewer-annotation-layer
  .anno.anno-locate-flash:not(.anno-done)
  line:not(.anno-hit),
#previewOverlay
  .viewer-annotation-layer
  .anno.anno-locate-flash:not(.anno-done)
  polyline:not(.anno-hit) {
  stroke-width: 3.5;
}

#previewOverlay .viewer-annotation-layer .anno-hover:not(.anno-selected) {
  filter: drop-shadow(0 0 4px rgba(37, 99, 235, 0.85)) drop-shadow(0 0 1px #fff);
}

#previewOverlay
  .viewer-annotation-layer
  .anno-hover:not(.anno-done)
  circle:not(.anno-hit),
#previewOverlay
  .viewer-annotation-layer
  .anno-hover:not(.anno-done)
  rect:not(.anno-hit),
#previewOverlay
  .viewer-annotation-layer
  .anno-hover:not(.anno-done)
  ellipse:not(.anno-hit),
#previewOverlay
  .viewer-annotation-layer
  .anno-hover:not(.anno-done)
  line:not(.anno-hit),
#previewOverlay
  .viewer-annotation-layer
  .anno-hover:not(.anno-done)
  polyline:not(.anno-hit) {
  stroke-width: 3.25;
}

#previewOverlay .viewer-annotation-layer .anno-group > .anno {
  pointer-events: none;
}

#previewOverlay .viewer-annotation-layer .anno-group > .anno .anno-hit {
  pointer-events: auto;
}

.check-item.is-anno-hover,
.comment.is-anno-hover {
  outline: 2px solid rgba(37, 99, 235, 0.55);
  outline-offset: 2px;
  background: rgba(37, 99, 235, 0.06);
}

#previewOverlay .viewer-annotation-layer text {
  font-family: "IBM Plex Sans JP", sans-serif;
  user-select: none;
  pointer-events: none;
}

#previewOverlay .viewer-annotation-layer .anno-hit {
  pointer-events: stroke;
  fill: none;
}

#previewOverlay .anno-tool-btn {
  min-width: 28px;
  min-height: 26px;
  padding: 3px 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#previewOverlay .anno-tool-btn svg {
  width: 14px;
  height: 14px;
  display: block;
}

#previewOverlay .anno-tool-btn.is-active {
  background: rgba(255, 255, 255, 0.2);
  border-color: var(--white);
}

#previewOverlay .anno-color-btn {
  width: 16px;
  height: 16px;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 2px;
  cursor: pointer;
  background-clip: padding-box;
}

#previewOverlay .anno-color-btn[data-anno-color="#ffffff"] {
  border-color: rgba(0, 0, 0, 0.35);
}

#previewOverlay .anno-color-btn.is-active {
  border-color: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
}

#previewOverlay .anno-color-btn[data-anno-color="#ffffff"].is-active {
  border-color: rgba(0, 0, 0, 0.55);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45);
}

#previewOverlay .viewer-canvas.is-space-select {
  cursor: default;
}

#previewOverlay .viewer-canvas.is-space-select.is-pannable {
  cursor: grab;
}

#previewOverlay .viewer-canvas.is-space-select.is-panning {
  cursor: grabbing;
}

#previewOverlay .viewer-canvas {
  position: relative;
}

#previewOverlay .anno-temp-actions {
  position: absolute;
  z-index: 21;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: var(--white);
  border: 1px solid var(--paper-line);
  box-shadow: 0 6px 18px rgba(44, 46, 51, 0.16);
  font-family: "IBM Plex Sans JP", sans-serif;
  pointer-events: auto;
}

#previewOverlay .anno-temp-actions[hidden] {
  display: none !important;
}

#previewOverlay .anno-temp-actions .anno-temp-btn {
  margin: 0;
  padding: 5px 10px;
  font-size: 12px;
  line-height: 1.2;
  border: 1px solid var(--paper-line);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
}

#previewOverlay .anno-temp-actions .anno-temp-btn.primary {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--white);
}

#previewOverlay .anno-temp-actions .anno-temp-btn:hover {
  filter: brightness(0.97);
}

#previewOverlay .anno-temp-actions .anno-temp-count {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  color: var(--ink-soft);
  padding: 0 2px;
  white-space: nowrap;
}

#previewOverlay .viewer-annotation-layer .anno-temp:not(.anno-draft) {
  opacity: 0.92;
}

#previewOverlay .viewer-annotation-layer .anno-temp circle:not(.anno-hit),
#previewOverlay .viewer-annotation-layer .anno-temp rect:not(.anno-hit),
#previewOverlay .viewer-annotation-layer .anno-temp ellipse:not(.anno-hit),
#previewOverlay .viewer-annotation-layer .anno-temp line:not(.anno-hit),
#previewOverlay .viewer-annotation-layer .anno-temp polyline:not(.anno-hit) {
  stroke-dasharray: 4 3;
}

#previewOverlay
  .viewer-annotation-layer
  .anno-temp.anno-pin
  circle:not(.anno-hit) {
  stroke-dasharray: none;
}

#previewOverlay .viewer-annotation-layer .anno-draft {
  opacity: 0.85;
}

#previewOverlay .anno-onboarding-tip {
  position: absolute;
  z-index: 24;
  top: 92px;
  left: 16px;
  max-width: min(340px, calc(100% - 32px));
  padding: 12px 14px;
  background: var(--white);
  color: var(--ink);
  border: 1px solid var(--paper-line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(44, 46, 51, 0.18);
  font-size: 12.5px;
  line-height: 1.55;
}

#previewOverlay .anno-onboarding-tip::before {
  content: "";
  position: absolute;
  top: -7px;
  left: 28px;
  width: 12px;
  height: 12px;
  background: var(--white);
  border-left: 1px solid var(--paper-line);
  border-top: 1px solid var(--paper-line);
  transform: rotate(45deg);
}

#previewOverlay .anno-onboarding-tip-title {
  font-weight: 600;
  font-size: 13px;
  margin: 0 0 6px;
  color: var(--ink);
}

#previewOverlay .anno-onboarding-tip-list {
  margin: 0 0 10px;
  padding-left: 1.2em;
  color: var(--ink-soft);
}

#previewOverlay .anno-onboarding-tip-list li {
  margin: 2px 0;
}

#previewOverlay .anno-onboarding-tip-actions {
  display: flex;
  justify-content: flex-end;
}

#previewOverlay .anno-onboarding-tip-actions .ghost-btn {
  font-size: 11.5px;
  padding: 5px 10px;
}

#previewOverlay .anno-compose-popup {
  position: absolute;
  z-index: 22;
  min-width: 240px;
  max-width: min(320px, calc(100% - 24px));
  max-height: calc(100% - 16px);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 12px;
  background: var(--white);
  border: 1px solid var(--paper-line);
  box-shadow: 0 8px 24px rgba(44, 46, 51, 0.18);
  font-family: "IBM Plex Sans JP", sans-serif;
  pointer-events: auto;
  box-sizing: border-box;
}

#previewOverlay .anno-compose-popup[hidden] {
  display: none !important;
}

#previewOverlay .anno-compose-popup .anno-compose-label {
  display: block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

#previewOverlay .anno-detail-popup {
  padding-top: 0;
}

#previewOverlay .anno-detail-popup .anno-detail-drag {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 -12px 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--paper-line);
  cursor: grab;
  user-select: none;
  touch-action: none;
}

#previewOverlay .anno-detail-popup .anno-detail-drag:active,
#previewOverlay .anno-detail-popup.is-dragging .anno-detail-drag {
  cursor: grabbing;
}

#previewOverlay .anno-detail-popup.is-dragging {
  box-shadow: 0 12px 28px rgba(44, 46, 51, 0.22);
}

#previewOverlay .anno-detail-popup .anno-detail-drag-title {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
  line-height: 1.2;
}

#previewOverlay .anno-detail-popup .anno-detail-drag-hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  opacity: 0.7;
  flex-shrink: 0;
}

#previewOverlay .anno-detail-popup .anno-detail-drag-hint svg {
  width: 14px;
  height: 14px;
  display: block;
}

#previewOverlay .anno-compose-popup textarea,
#previewOverlay .anno-compose-popup input[type="text"] {
  width: 100%;
  min-height: 56px;
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 13px;
  padding: 8px 10px;
  border: 1px solid var(--paper-line);
  background: var(--paper);
  color: var(--ink);
  resize: vertical;
  box-sizing: border-box;
}

#previewOverlay .anno-compose-popup input[type="text"] {
  min-height: 0;
}

#previewOverlay .anno-compose-popup textarea:focus,
#previewOverlay .anno-compose-popup input[type="text"]:focus {
  outline: none;
  border-color: var(--ink);
}

#previewOverlay .anno-compose-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 10px 0 12px;
  font-size: 12.5px;
  color: var(--ink);
  cursor: pointer;
}

#previewOverlay .anno-compose-check input {
  margin-top: 2px;
}

#previewOverlay .anno-compose-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

#previewOverlay .anno-compose-actions .ghost-btn,
#previewOverlay .anno-compose-actions .primary-btn {
  margin-top: 0;
  padding: 6px 12px;
  font-size: 12px;
}

#previewOverlay .anno-detail-popup .anno-detail-text {
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink);
  margin-bottom: 10px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 140px;
  overflow: auto;
}

#previewOverlay .anno-detail-popup .anno-detail-meta {
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 8px;
}

#previewOverlay .anno-detail-popup .anno-detail-origin {
  margin: -2px 0 10px;
  padding: 8px 10px;
  background: rgba(44, 46, 51, 0.04);
  border: 1px dashed var(--paper-line);
}

#previewOverlay .anno-detail-popup .anno-detail-origin[hidden] {
  display: none !important;
}

#previewOverlay .anno-detail-popup .anno-detail-origin-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

#previewOverlay .anno-detail-popup .anno-detail-origin-btn {
  display: inline-block;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  color: var(--ink);
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 12.5px;
  line-height: 1.4;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  text-align: left;
}

#previewOverlay .anno-detail-popup .anno-detail-origin-btn:hover {
  color: var(--red);
}

#previewOverlay .anno-compose-priority {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin: 8px 0 10px;
  font-size: 12.5px;
  color: var(--ink);
}

#previewOverlay .anno-compose-priority label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  font-size: 12.5px;
}

#previewOverlay .anno-compose-priority input {
  margin: 0;
}

.priority-radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 13px;
  color: var(--ink);
}

.priority-radio-group label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.priority-radio-group input {
  margin: 0;
}

/* 優先順位の線色上書きはしない（ツールバーで選んだ color を尊重） */

.priority-badge {
  display: inline-flex;
  align-items: center;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
  vertical-align: middle;
  white-space: nowrap;
}

.priority-badge.priority-high {
  color: #fff;
  background: #e74c3c;
  border-color: #c0392b;
}

.priority-badge.priority-medium {
  color: #fff;
  background: #f39c12;
  border-color: #d68910;
}

.priority-badge.priority-low {
  color: #fff;
  background: #3498db;
  border-color: #2980b9;
}

.check-item.priority-high {
  box-shadow: inset 3px 0 0 #e74c3c;
}

.check-item.priority-medium {
  box-shadow: inset 3px 0 0 #f39c12;
}

.check-item.priority-low {
  box-shadow: inset 3px 0 0 #3498db;
}

.check-item.is-mine-active.priority-high {
  border-left-color: #e74c3c;
}

.check-item.is-mine-active.priority-medium {
  border-left-color: #f39c12;
}

.check-item.is-mine-active.priority-low {
  border-left-color: #3498db;
}

#previewOverlay .anno-detail-popup .anno-detail-status {
  margin-bottom: 12px;
}

.viewer-loading {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
  background: #e5e7eb;
}

/* display:flex が hidden を打ち消さないようにする */
.viewer-loading[hidden] {
  display: none !important;
}

.viewer-spinner {
  width: 22px;
  height: 22px;
  border: 2px solid var(--paper-line);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: viewer-spin 0.7s linear infinite;
}

@keyframes viewer-spin {
  to {
    transform: rotate(360deg);
  }
}

.viewer-pdf-error {
  max-width: 360px;
  padding: 20px;
  text-align: center;
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 13.5px;
  color: var(--ink);
  line-height: 1.6;
}

.viewer-pdf-error a {
  color: var(--ink);
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
}

#previewOverlay .viewer-canvas img,
#previewOverlay .viewer-canvas embed {
  max-width: 100%;
  max-height: 100%;
}

#previewOverlay .preview-name,
#previewOverlay .viewer-meta {
  flex-shrink: 0;
}

.preview-close-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 3;
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--white);
  border: 1.5px solid var(--ink);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(44, 46, 51, 0.18);
}

.preview-close-btn span {
  position: relative;
  display: block;
  width: 16px;
  height: 16px;
}

.preview-close-btn span::before,
.preview-close-btn span::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  transform-origin: center;
}

.preview-close-btn span::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.preview-close-btn span::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.preview-close-btn:hover {
  background: var(--paper);
  border-color: var(--ink);
  color: var(--ink);
}

.preview-close-btn:focus-visible {
  outline: 2px solid var(--admin-accent, #2f5fa3);
  outline-offset: 2px;
}

/* 添付ファイル切替（オーバーレイ左右端）※ PDFページ送りとは別UI */
.viewer-attach-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 44px;
  height: 72px;
  padding: 0;
  margin: 0;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--white);
  font-family: "IBM Plex Mono", monospace;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.viewer-attach-nav:hover {
  background: var(--white);
  color: var(--ink);
}

.viewer-attach-nav[hidden] {
  display: none !important;
}

.viewer-attach-nav-prev {
  left: 10px;
}

.viewer-attach-nav-next {
  right: 10px;
}

.modal {
  background: var(--white);
  max-width: 460px;
  width: 100%;
  padding: 26px;
  max-height: 86vh;
  overflow: auto;
}

.settings-page {
  width: 100%;
  max-width: 960px;
  margin: 16px auto 0;
}

.settings-back {
  margin-bottom: 18px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
}

.settings-back a {
  color: var(--ink-soft);
  text-decoration: none;
}

.settings-back a:hover {
  color: var(--ink);
  text-decoration: underline;
}

.settings-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.settings-page-header h2 {
  margin: 0 0 6px;
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.35;
}

.settings-page-header p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.65;
}

#projectSettingsRoot {
  max-width: 880px;
}

#projectSettingsRoot .settings-tabs {
  gap: 0;
  margin: 0;
  border-bottom: 1px solid var(--paper-line);
}

#projectSettingsRoot .settings-tabs .subtab {
  position: relative;
  min-width: 112px;
  padding: 11px 18px;
  border: 0;
  background: transparent;
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 13px;
  letter-spacing: 0;
}

#projectSettingsRoot .settings-tabs .subtab.active {
  background: transparent;
}

#projectSettingsRoot .settings-tabs .subtab.active::after {
  content: "";
  position: absolute;
  right: 14px;
  bottom: -1px;
  left: 14px;
  height: 2px;
  background: var(--ink);
}

.settings-panel {
  padding: 26px 28px 28px;
  background: var(--white);
  border: 1px solid var(--paper-line);
  border-top: 0;
}

#projectSettingsRoot .field {
  margin-bottom: 20px;
}

#projectSettingsRoot .field:last-child {
  margin-bottom: 0;
}

#projectSettingsRoot .field > label:not(.member-opt) {
  display: block;
  margin-bottom: 7px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}

#projectSettingsRoot input[type="text"],
#projectSettingsRoot input[type="number"],
#projectSettingsRoot select,
#projectSettingsRoot textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--paper-line);
  background: var(--white);
  color: var(--ink);
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 14px;
}

#projectSettingsRoot textarea {
  min-height: 96px;
  resize: vertical;
}

#projectSettingsRoot input:focus,
#projectSettingsRoot select:focus,
#projectSettingsRoot textarea:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 2px rgba(44, 46, 51, 0.08);
}

#projectSettingsRoot .new-proj-member-lists {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  max-height: none;
  margin-top: 12px;
  padding: 16px;
  background: var(--paper);
}

#projectSettingsRoot .new-proj-member-lists .member-group {
  min-width: 0;
  margin: 0;
  padding: 0;
  background: var(--white);
  border: 1px solid var(--paper-line);
}

#projectSettingsRoot .member-group-label {
  padding: 9px 12px;
  border-bottom: 1px solid var(--paper-line);
  background: #fafafb;
}

#projectSettingsRoot .member-opt {
  padding: 9px 12px;
  border-bottom: 1px solid #eceef1;
  font-size: 13px;
}

#projectSettingsRoot .member-opt:last-child {
  border-bottom: 0;
}

#projectSettingsRoot .member-manage-row {
  min-height: 44px;
  padding: 8px 10px;
  background: var(--white);
}

#projectSettingsFilesZone {
  position: relative;
  padding: 16px;
  border: 1px dashed #b9bec7;
  background: #fafafb;
}

.modal-lg {
  max-width: 640px;
}

.modal h3 {
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 19px;
  font-weight: 600;
  margin: 0 0 18px;
}

.modal .field {
  margin-bottom: 16px;
}

.modal label {
  display: block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.modal input[type="text"] {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--paper-line);
  font-size: 14px;
  font-family: "IBM Plex Sans JP", sans-serif;
}

.modal input[type="text"]:focus {
  outline: none;
  border-color: var(--ink);
}

.modal input[type="datetime-local"] {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--paper-line);
  font-size: 14px;
  font-family: "IBM Plex Sans JP", sans-serif;
  background: var(--white);
  color: var(--ink);
}

.modal input[type="datetime-local"]:focus {
  outline: none;
  border-color: var(--ink);
}

.modal input[type="number"] {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--paper-line);
  font-size: 14px;
  font-family: "IBM Plex Sans JP", sans-serif;
  background: var(--white);
  color: var(--ink);
}

.modal input[type="number"]:focus {
  outline: none;
  border-color: var(--ink);
}

.modal input[type="password"] {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--paper-line);
  font-size: 14px;
  font-family: "IBM Plex Sans JP", sans-serif;
  background: var(--white);
  color: var(--ink);
}

.modal input[type="password"]:focus {
  outline: none;
  border-color: var(--ink);
}

.user-actions {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
}

.user-pw-btn {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--paper-line);
  padding: 3px 8px;
  cursor: pointer;
}

.user-pw-btn:hover {
  border-color: var(--ink);
  background: var(--white);
}

#newProjMemberSearch {
  margin-bottom: 12px;
}

.new-proj-member-lists {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--paper-line);
  padding: 4px 0;
}

.new-proj-member-lists .member-group:last-child {
  margin-bottom: 0;
}

.member-group {
  margin-bottom: 10px;
}

.member-group-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  color: var(--ink-soft);
  margin-bottom: 6px;
  letter-spacing: 0.06em;
}

.member-company-group {
  margin-bottom: 8px;
}

.member-company-heading {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
  padding: 6px 8px 2px;
}

.member-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  cursor: pointer;
}

.member-opt:hover {
  background: var(--paper);
}

.member-opt input {
  cursor: pointer;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

.preview-body {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
}

.viewer-frame {
  border: 1px solid var(--ink-soft);
  background: var(--white);
}

.viewer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--ink);
  color: var(--white);
  padding: 8px 12px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
}

/* 最新版: 作業中であることが分かる青系濃色（旧版は上記の黒系のまま） */
.viewer-toolbar.is-latest {
  background: var(--viewer-toolbar-latest);
}

.viewer-toolbar .vt-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* display:flex が [hidden] の UA スタイルを上書きするため明示 */
.viewer-toolbar .vt-group[hidden] {
  display: none !important;
}

.viewer-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: var(--white);
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  padding: 4px 8px;
  cursor: pointer;
  line-height: 1;
}

.viewer-btn:hover {
  border-color: var(--white);
  background: rgba(255, 255, 255, 0.12);
}

.viewer-btn:disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

.viewer-btn:disabled:hover {
  border-color: rgba(255, 255, 255, 0.4);
  background: transparent;
}

.focus-only-badge {
  display: inline-block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  color: #f5efd6;
  background: rgba(245, 239, 214, 0.18);
  border: 1px solid rgba(224, 212, 168, 0.55);
  padding: 3px 6px;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.viewer-page {
  padding: 0 4px;
}

.viewer-canvas {
  height: 340px;
  /* #previewOverlay 内では flex 可変高さに上書き */
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e5e7eb;
  overflow: hidden;
}

.viewer-canvas.doc {
  background: var(--paper);
}

.preview-thumb-img {
  width: 86%;
  height: 88%;
  background: linear-gradient(135deg, #eae7e0, #f7f5f1 60%, #d9d4c8);
  border: 1px solid var(--paper-line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "IBM Plex Mono", monospace;
  color: var(--ink-soft);
  font-size: 12px;
}

.preview-thumb-doc {
  width: 70%;
  height: 88%;
  background: var(--white);
  border: 1px solid var(--paper-line);
  box-shadow: 0 2px 10px rgba(44, 46, 51, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--ink-soft);
}

.preview-thumb-doc svg {
  width: 46px;
  height: 46px;
}

.preview-name {
  font-size: 12.5px;
  font-weight: 500;
  padding: 12px 14px 0;
}

.viewer-meta {
  font-size: 11.5px;
  color: var(--ink-soft);
  padding: 10px 14px 14px;
  font-family: "IBM Plex Mono", monospace;
}

.assign-select,
.modal select {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--paper-line);
  font-size: 14px;
  font-family: "IBM Plex Sans JP", sans-serif;
  background: var(--white);
}

.modal textarea {
  width: 100%;
  min-height: 56px;
  padding: 9px 10px;
  border: 1px solid var(--paper-line);
  font-size: 14px;
  font-family: "IBM Plex Sans JP", sans-serif;
  resize: vertical;
}

.edit-proj-file-meta {
  display: block;
  margin-top: 2px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  color: var(--ink-soft);
}

.member-manage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 8px;
  border-bottom: 1px solid var(--paper-line);
  font-size: 13px;
}

.member-manage-row:last-child {
  border-bottom: none;
}

.member-remove-btn {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  color: var(--red);
  background: var(--red-soft);
  border: 1px solid var(--red);
  padding: 3px 8px;
  cursor: pointer;
}

.member-remove-btn:hover {
  background: var(--red);
  color: var(--white);
}

.lock-note {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  color: var(--ink-soft);
  padding: 10px 12px;
  border: 1px dashed var(--paper-line);
  background: var(--paper);
}

.file-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.file-input-row input[type="file"] {
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 12px;
  max-width: 100%;
}

/* 指摘追加・バージョンアップロードモーダル: FileUploader の dropZone（モーダル全体） */
#newItemOverlay .modal,
#uploadVersionOverlay .modal,
#bulkPageUploadOverlay .modal {
  position: relative;
}

/* 汎用 FileUploader: dragover 時の濃色オーバーレイ＋白文字 */
.comment-form.is-dragover,
#projectSettingsFilesZone.is-dragover,
#newItemOverlay .modal.is-dragover,
#uploadVersionOverlay .modal.is-dragover,
#bulkPageUploadOverlay .modal.is-dragover {
  outline: none;
}

.comment-form.is-dragover::before,
#projectSettingsFilesZone.is-dragover::before,
#newItemOverlay .modal.is-dragover::before,
#uploadVersionOverlay .modal.is-dragover::before,
#bulkPageUploadOverlay .modal.is-dragover::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 20;
  background: rgba(20, 22, 26, 0.78);
  pointer-events: none;
}

.comment-form.is-dragover::after,
#projectSettingsFilesZone.is-dragover::after,
#newItemOverlay .modal.is-dragover::after,
#uploadVersionOverlay .modal.is-dragover::after,
#bulkPageUploadOverlay .modal.is-dragover::after {
  content: "ここにファイルをドロップ";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 21;
  color: #fff;
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.06em;
  white-space: nowrap;
  pointer-events: none;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}

/* 汎用 FileUploader: 投稿前プレビュー */
.file-uploader-preview,
.picked-files:has(.file-uploader-item) {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.file-uploader-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 140px;
  max-width: 220px;
  padding: 8px 28px 8px 8px;
  box-sizing: border-box;
  background: var(--paper);
  border: 1px solid var(--paper-line);
  color: var(--ink-soft);
}

.file-uploader-item.is-image {
  flex-direction: column;
  align-items: stretch;
  padding: 8px 8px 8px 8px;
  max-width: 120px;
  min-width: 96px;
}

.file-uploader-thumb {
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--paper-line);
  background: var(--white);
}

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

.file-uploader-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-uploader-icon svg {
  width: 22px;
  height: 22px;
}

.file-uploader-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.file-uploader-item.is-image .file-uploader-meta {
  margin-top: 6px;
  padding-right: 18px;
}

.file-uploader-name {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-uploader-size {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  opacity: 0.85;
}

.file-uploader-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  z-index: 1;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 0;
  background: var(--white);
  color: var(--ink-soft);
  cursor: pointer;
  padding: 0;
  font-size: 14px;
  line-height: 1;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 1px var(--paper-line);
}

.file-uploader-remove:hover {
  color: var(--ink);
  background: var(--red-soft, #f5e8e6);
  box-shadow: 0 0 0 1px var(--red, #c33b2b);
}

.picked-files {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.bulk-page-upload-progress {
  margin: 10px 0 0;
  padding: 8px 10px;
  border: 1px solid var(--paper-line);
  background: var(--paper);
  font-size: 12.5px;
  color: var(--ink);
  line-height: 1.45;
}

.bulk-page-upload-progress.is-error {
  border-color: var(--ink);
}

.bulk-page-upload-fail-list {
  margin: 6px 0 0;
  padding-left: 1.2em;
  color: var(--ink-soft);
  font-size: 12px;
}

.bulk-page-upload-fail-list li {
  margin: 2px 0;
}

.export-project-files-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  font-weight: 500;
}

.export-project-files-check input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--ink);
  cursor: pointer;
}

.picked-chip {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  background: var(--paper);
  border: 1px solid var(--paper-line);
  padding: 3px 8px;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  box-sizing: border-box;
}

.picked-chip-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.picked-chip-size {
  flex-shrink: 0;
  opacity: 0.85;
}

.picked-chip-remove {
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 0 2px;
  font-size: 14px;
  line-height: 1;
  font-family: inherit;
}

.picked-chip-remove:hover {
  color: var(--ink);
}

.comment-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.comment-attach-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.comment-attach-thumb {
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid var(--paper-line);
  background: var(--paper);
  cursor: pointer;
  overflow: hidden;
  display: block;
  flex-shrink: 0;
}

.comment-attach-thumb:hover {
  border-color: var(--ink);
}

.comment-attach-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  vertical-align: top;
}

.comment-attach-chip {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  background: var(--white);
  border: 1px solid var(--paper-line);
  padding: 4px 9px;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
}

.comment-attach-chip:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.comment-attach-chip svg {
  width: 11px;
  height: 11px;
}

.sync-list {
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--paper-line);
}

.sync-list .member-opt {
  font-size: 13px;
}

.email-mock {
  border: 1px solid var(--paper-line);
  background: var(--paper);
}

.email-row {
  display: flex;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--paper-line);
  font-size: 13px;
}

.email-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  color: var(--ink-soft);
  text-transform: uppercase;
  min-width: 44px;
  padding-top: 1px;
}

.email-body {
  padding: 16px 14px;
  font-size: 13px;
  line-height: 1.8;
  white-space: pre-wrap;
  font-family: "IBM Plex Sans JP", sans-serif;
}

.comment.system-comment {
  gap: 8px;
  margin-bottom: 10px;
  align-items: stretch;
}

.comment.system-comment .c-avatar {
  width: 18px;
  height: 18px;
  margin-top: 4px;
  font-size: 9px;
  font-weight: 500;
  color: var(--ink-soft);
  background: transparent;
  border: none;
  border-radius: 0;
}

.comment.system-comment .c-name,
.comment.system-comment .c-time {
  font-size: 10px;
  font-weight: 500;
  color: var(--ink-soft);
}

.comment.system-comment .c-text {
  font-size: 11.5px;
  line-height: 1.5;
  font-style: normal;
  color: var(--ink-soft);
  background: #eef0f3;
  border: none;
  border-left: 3px solid #d1d5db;
  padding: 6px 10px;
  border-radius: 0;
}

.comment .c-text a.annotation-deep-link {
  color: var(--ink);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.comment .c-text a.annotation-deep-link:hover {
  color: var(--accent, #2563eb);
}

footer {
  margin-top: 32px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  color: var(--ink-soft);
  letter-spacing: 0.05em;
}

/* ========== Admin screen / modal scope (direction A) ========== */
.admin-screen {
  background: var(--admin-bg);
  color: var(--admin-text);
  margin: 16px 0 0;
  padding: 20px 20px 28px;
  border: 1px solid var(--admin-border);
  border-radius: 8px;
}

.admin-screen .admin-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 8px;
}

.admin-screen .admin-summary-card {
  background: var(--white);
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-screen .admin-summary-label {
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 12px;
  color: var(--admin-text-muted);
  letter-spacing: 0;
  text-transform: none;
}

.admin-screen .admin-summary-value {
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 26px;
  font-weight: 600;
  color: var(--admin-text);
  line-height: 1.1;
}

.admin-hub-groups {
  display: flex;
  flex-direction: column;
  gap: 22px;
  margin-top: 8px;
}

.admin-hub-group-title {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--admin-text-muted);
}

.admin-hub-menu {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 0;
}

.admin-hub-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  text-align: left;
  background: var(--white);
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  padding: 14px 16px;
  cursor: pointer;
  color: var(--admin-text);
  font-family: "IBM Plex Sans JP", sans-serif;
}

.admin-hub-item:hover {
  border-color: var(--admin-accent);
  background: var(--paper);
}

.admin-hub-item-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
}

.admin-hub-item-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.admin-hub-item-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--admin-warning);
  border: 1px solid var(--admin-warning);
  border-radius: 4px;
  padding: 1px 6px;
  line-height: 1.4;
  white-space: nowrap;
}

.admin-hub-item-badge-danger {
  color: var(--admin-error);
  border-color: var(--admin-error);
}

.admin-hub-item-desc {
  font-size: 12.5px;
  color: var(--admin-text-muted);
  line-height: 1.45;
  white-space: pre-line;
}

.admin-hub-item-caution {
  margin-top: 4px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--admin-error);
  line-height: 1.4;
}

.admin-hub-item-warn {
  border-color: var(--admin-warning);
  background: #fffcf5;
}

.admin-hub-item-warn:hover {
  border-color: var(--admin-warning);
}

/* 危険操作: 他カードと同列の「気軽なカード」に見えないよう分離 */
.admin-hub-item-danger {
  margin-top: 6px;
  border-color: var(--admin-error);
  background: var(--admin-error-soft);
}

.admin-hub-item-danger:hover {
  border-color: var(--admin-error);
  background: var(--admin-error-soft);
}

.admin-hub-item-danger .admin-hub-item-title {
  color: var(--admin-error);
}

.admin-cron-health-warn {
  color: var(--admin-warning);
  font-weight: 600;
}

.admin-screen .toolbar {
  margin: 14px 0 12px;
  color: var(--admin-text-muted);
}

.admin-screen .admin-toolbar-meta {
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 12.5px;
  letter-spacing: 0;
}

.admin-screen .primary-btn {
  background: var(--admin-accent);
  border-color: var(--admin-accent);
  color: var(--white);
}

.admin-screen .primary-btn:hover {
  background: var(--admin-accent-hover);
  border-color: var(--admin-accent-hover);
}

.admin-screen .ghost-btn {
  border-color: var(--admin-border);
  background: var(--white);
  color: var(--admin-text);
}

.admin-screen .ghost-btn:hover {
  border-color: var(--admin-accent);
  color: var(--admin-accent);
  background: var(--admin-accent-soft);
}

.admin-screen .page-list-controls {
  margin: 0 0 14px;
  padding: 12px 14px;
  background: var(--white);
  border: 1px solid var(--admin-border);
  border-radius: 8px;
}

.admin-screen .page-filter-label {
  color: var(--admin-text-muted);
  text-transform: none;
  letter-spacing: 0;
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 12px;
  margin-right: 8px;
}

.admin-screen .page-filter-chip {
  border-radius: 999px;
  border-color: var(--admin-border);
  background: var(--white);
  color: var(--admin-text-muted);
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 12.5px;
  padding: 6px 12px;
}

.admin-screen .page-filter-chip:hover {
  border-color: var(--admin-accent);
  color: var(--admin-accent);
}

.admin-screen .page-filter-chip.active {
  background: var(--admin-accent);
  border-color: var(--admin-accent);
  color: var(--white);
  font-weight: 600;
}

.admin-screen .user-filter-select {
  border-radius: 999px;
  border-color: var(--admin-border);
  padding: 6px 14px;
  font-size: 12.5px;
  color: var(--admin-text);
  background: var(--white);
}

.admin-screen .user-filter-select:focus {
  outline: none;
  border-color: var(--admin-accent);
  box-shadow: 0 0 0 3px var(--admin-accent-soft);
}

.admin-screen .admin-users-table {
  background: var(--white);
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  overflow: hidden;
  border-collapse: separate;
  border-spacing: 0;
}

.admin-screen .admin-users-table thead th {
  background: var(--white);
  border-bottom: 1px solid var(--admin-border);
  color: var(--admin-text-muted);
  text-transform: none;
  letter-spacing: 0;
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 12px;
  font-weight: 600;
  padding: 12px 14px;
}

.admin-screen .admin-users-table tbody tr {
  border-bottom: none;
  cursor: default;
  transition: background 0.12s ease;
}

.admin-screen .admin-users-table tbody tr + tr td {
  border-top: 1px solid transparent;
}

.admin-screen .admin-users-table tbody tr:hover {
  background: var(--admin-accent-soft);
}

.admin-screen .admin-users-table tbody tr:hover td {
  border-top-color: transparent;
}

.admin-screen .admin-users-table td {
  padding: 14px;
  border-bottom: 1px solid var(--admin-border);
  font-size: 13.5px;
}

.admin-screen .admin-users-table tbody tr:last-child td {
  border-bottom: none;
}

.admin-screen .org-badge {
  border: none;
  border-radius: 999px;
  padding: 4px 12px;
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 12px;
  font-weight: 600;
  background: #f3f4f6;
  color: #374151;
}

.admin-screen .org-badge.staff {
  background: var(--admin-accent-soft);
  color: var(--admin-accent);
}

.admin-screen .org-badge.client {
  background: #f3f4f6;
  color: #374151;
  border-color: transparent;
}

.admin-screen .org-badge.inactive {
  margin-left: 8px;
  vertical-align: middle;
  background: #fee2e2;
  color: #b91c1c;
}

.admin-screen .org-badge.super {
  margin-left: 8px;
  vertical-align: middle;
  background: #fef3c7;
  color: #92400e;
}

.admin-screen .user-row-inactive td {
  opacity: 0.72;
}

.admin-screen .user-actions {
  gap: 4px;
}

.admin-screen .user-pw-btn,
.admin-screen .member-remove-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--admin-border);
  background: var(--white);
  color: var(--admin-text-muted);
  cursor: pointer;
}

.admin-screen .user-pw-btn svg,
.admin-screen .member-remove-btn svg {
  width: 16px;
  height: 16px;
  display: block;
}

.admin-screen .user-pw-btn:hover {
  border-color: var(--admin-accent);
  color: var(--admin-accent);
  background: var(--admin-accent-soft);
}

.admin-screen .member-remove-btn {
  color: var(--admin-text-muted);
  background: var(--white);
  border-color: var(--admin-border);
}

.admin-screen .member-remove-btn:hover {
  color: var(--admin-error);
  border-color: var(--admin-error);
  background: var(--admin-error-soft);
}

.admin-screen .admin-self-label {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--admin-border);
  background: #f3f4f6;
  color: var(--admin-text-muted);
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 12px;
}

.admin-modal .modal {
  background: var(--white);
  color: var(--admin-text);
  border: 1px solid var(--admin-border);
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.12);
}

.admin-modal .modal h3 {
  margin: 0 0 12px;
  font-size: 18px;
}

.admin-modal .admin-section {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--admin-border);
}

.admin-modal .admin-section:first-of-type {
  margin-top: 8px;
}

.admin-modal .admin-section-label {
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: var(--admin-text-muted);
  letter-spacing: 0.04em;
  margin: 0 0 12px;
}

.admin-modal .admin-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.admin-modal .admin-field-row > .field {
  margin-bottom: 0;
}

.admin-modal .modal .field {
  margin-bottom: 14px;
}

.admin-modal .modal label {
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--admin-text);
  margin-bottom: 6px;
}

.admin-modal .modal input[type="text"],
.admin-modal .modal input[type="email"],
.admin-modal .modal input[type="password"],
.admin-modal .modal input[type="number"],
.admin-modal .modal select,
.admin-modal .modal textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  background: var(--white);
  color: var(--admin-text);
  font-size: 14px;
  font-family: "IBM Plex Sans JP", sans-serif;
}

.admin-modal .modal input[type="text"]:focus,
.admin-modal .modal input[type="email"]:focus,
.admin-modal .modal input[type="password"]:focus,
.admin-modal .modal input[type="number"]:focus,
.admin-modal .modal select:focus,
.admin-modal .modal textarea:focus {
  outline: none;
  border-color: var(--admin-accent);
  box-shadow: 0 0 0 3px var(--admin-accent-soft);
}

.admin-modal .admin-hint,
.admin-modal .lock-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 0 14px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--admin-text-muted);
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 12.5px;
  line-height: 1.5;
}

.admin-modal .admin-section > .lock-note {
  margin-top: 10px;
  margin-bottom: 0;
}

.admin-modal .member-opt {
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  margin-bottom: 6px;
  padding: 10px 12px;
  background: var(--white);
}

.admin-modal .member-opt:last-of-type {
  margin-bottom: 0;
}

.admin-modal .member-opt:hover {
  background: var(--admin-accent-soft);
  border-color: var(--admin-accent);
}

.admin-modal .member-opt label {
  display: inline;
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--admin-text);
  cursor: pointer;
}

.admin-modal .admin-check-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  background: var(--white);
  text-transform: none;
  letter-spacing: 0;
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--admin-text);
  cursor: pointer;
}

.admin-modal .admin-check-label:hover {
  background: var(--admin-accent-soft);
  border-color: var(--admin-accent);
}

.admin-modal .admin-check-label input {
  width: auto;
  margin: 0;
  cursor: pointer;
}

.admin-modal .admin-inline-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.admin-modal .admin-inline-row > .field {
  flex: 1;
  min-width: 0;
}

.admin-modal .companies-form-actions {
  justify-content: flex-end;
}

.admin-modal .companies-master-table {
  margin-top: 0;
}

.admin-modal .companies-master-table .user-actions {
  gap: 4px;
}

.admin-modal .companies-master-table .user-pw-btn,
.admin-modal .companies-master-table .member-remove-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--admin-border);
  background: var(--white);
  color: var(--admin-text-muted);
  cursor: pointer;
}

.admin-modal .companies-master-table .user-pw-btn svg,
.admin-modal .companies-master-table .member-remove-btn svg {
  width: 16px;
  height: 16px;
  display: block;
}

.admin-modal .companies-master-table .user-pw-btn:hover {
  border-color: var(--admin-accent);
  color: var(--admin-accent);
  background: var(--admin-accent-soft);
}

.admin-modal .companies-master-table .member-remove-btn:hover:not(:disabled) {
  color: var(--admin-error);
  border-color: var(--admin-error);
  background: var(--admin-error-soft);
}

.admin-modal .companies-master-table .member-remove-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.admin-modal .admin-inline-row > input {
  flex: 1;
  min-width: 0;
}

.admin-modal .admin-inline-row .ghost-btn {
  flex-shrink: 0;
  white-space: nowrap;
}

.admin-modal .admin-test-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 10px;
}

.admin-modal .orphan-cleanup-list {
  max-height: min(50vh, 420px);
  overflow: auto;
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  background: var(--white);
  padding: 0;
}

.admin-modal .orphan-cleanup-list > .detail-sub {
  padding: 14px;
}

.admin-modal .orphan-cleanup-table {
  width: 100%;
  margin: 0;
  border: none;
  border-radius: 0;
}

.admin-modal .orphan-cleanup-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--white);
  border-bottom: 1px solid var(--admin-border);
  color: var(--admin-text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 10px 12px;
  text-align: left;
}

.admin-modal .orphan-cleanup-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--admin-border);
  font-size: 13px;
  vertical-align: middle;
}

.admin-modal .orphan-cleanup-table tbody tr:last-child td {
  border-bottom: none;
}

.admin-modal .admin-test-row .lock-note {
  margin: 0;
  flex: 1;
  min-width: 12em;
}

.admin-modal .admin-hint::before,
.admin-modal .lock-note::before {
  content: "";
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin-top: 2px;
  background-color: var(--admin-accent);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 10v6'/%3E%3Ccircle cx='12' cy='7' r='1' fill='black' stroke='none'/%3E%3C/svg%3E")
    center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 10v6'/%3E%3Ccircle cx='12' cy='7' r='1' fill='black' stroke='none'/%3E%3C/svg%3E")
    center / contain no-repeat;
}

.admin-modal .modal-actions {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--admin-border);
}

.admin-modal .primary-btn {
  background: var(--admin-accent);
  border-color: var(--admin-accent);
  color: var(--white);
  border-radius: 8px;
}

.admin-modal .primary-btn:hover {
  background: var(--admin-accent-hover);
  border-color: var(--admin-accent-hover);
}

.admin-modal .ghost-btn {
  border-color: var(--admin-border);
  background: var(--white);
  color: var(--admin-text);
  border-radius: 8px;
}

.admin-modal .ghost-btn:hover {
  border-color: var(--admin-accent);
  color: var(--admin-accent);
  background: var(--admin-accent-soft);
}

/* モーダルからページ化した管理設定画面 */
.admin-screen.admin-settings-page {
  max-width: 960px;
  margin: 16px auto 0;
  padding: 28px;
  border-radius: 8px;
}

.admin-settings-page .settings-back {
  margin-bottom: 20px;
}

.admin-settings-page .settings-page-header {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--admin-border);
}

.admin-settings-page .settings-page-header h2 {
  color: var(--admin-text);
  font-size: 22px;
}

.admin-settings-page .settings-page-header p {
  color: var(--admin-text-muted);
}

.admin-settings-page .admin-section {
  margin-top: 16px;
  padding: 20px;
  background: var(--white);
  border: 1px solid var(--admin-border);
  border-radius: 8px;
}

.admin-settings-page .admin-section-label {
  margin: 0 0 16px;
  color: var(--admin-text);
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 14px;
  font-weight: 600;
}

.admin-settings-page .field {
  margin-bottom: 16px;
}

.admin-settings-page .field:last-child {
  margin-bottom: 0;
}

.admin-settings-page .field > label:not(.admin-check-label) {
  display: block;
  margin-bottom: 7px;
  color: var(--admin-text);
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 12px;
  font-weight: 600;
}

.admin-settings-page input[type="text"],
.admin-settings-page input[type="email"],
.admin-settings-page input[type="password"],
.admin-settings-page input[type="number"],
.admin-settings-page select,
.admin-settings-page textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--admin-border);
  border-radius: 6px;
  background: var(--white);
  color: var(--admin-text);
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 14px;
}

.admin-settings-page textarea {
  resize: vertical;
}

.admin-settings-page input[type="text"]:focus,
.admin-settings-page input[type="email"]:focus,
.admin-settings-page input[type="password"]:focus,
.admin-settings-page input[type="number"]:focus,
.admin-settings-page select:focus,
.admin-settings-page textarea:focus {
  outline: none;
  border-color: var(--admin-accent);
  box-shadow: 0 0 0 3px var(--admin-accent-soft);
}

.admin-settings-page .admin-field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.admin-settings-page .admin-inline-row,
.admin-settings-page .admin-test-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-settings-page .admin-test-row {
  flex-wrap: wrap;
  margin-top: 12px;
}

.admin-settings-page .admin-inline-row > input,
.admin-settings-page .admin-test-row > .lock-note {
  flex: 1;
  min-width: 0;
}

.admin-settings-page .admin-check-label {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--admin-border);
  border-radius: 6px;
  background: var(--admin-bg);
  color: var(--admin-text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.admin-settings-page .admin-check-label:hover {
  border-color: var(--admin-accent);
  background: var(--admin-accent-soft);
}

.admin-settings-page .admin-check-label input {
  width: auto;
  margin: 0;
}

.admin-settings-page .lock-note {
  color: var(--admin-text-muted);
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 12px;
  line-height: 1.55;
}

.admin-settings-page > .toolbar:last-child {
  margin: 20px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--admin-border);
}

.admin-settings-page .primary-btn,
.admin-settings-page .ghost-btn,
.admin-settings-page .danger-btn {
  border-radius: 6px;
}

.admin-settings-page .admin-upload-ext-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}

.admin-settings-page .admin-upload-ext-warn {
  margin-left: 6px;
  color: var(--admin-error);
  font-size: 11px;
  font-weight: 600;
}

.admin-settings-page .admin-upload-limit-warn {
  color: var(--admin-error);
}

.admin-settings-page .orphan-cleanup-list {
  max-height: min(50vh, 420px);
  overflow: auto;
  border: 1px solid var(--admin-border);
  border-radius: 6px;
  background: var(--white);
}

.admin-settings-page .demo-data-login-list {
  margin: 0;
  padding-left: 1.25em;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.7;
}

.admin-settings-page .demo-data-login-list code {
  font-size: 12px;
  color: var(--ink);
}

.mail-tpl-layout {
  display: grid;
  grid-template-columns: minmax(160px, 200px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.mail-tpl-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  background: var(--white);
}

.mail-tpl-nav-item {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--admin-text);
  text-align: left;
  padding: 10px 12px;
  border-radius: 6px;
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.mail-tpl-nav-item:hover {
  background: var(--admin-bg);
}

.mail-tpl-nav-item.is-active {
  background: var(--admin-accent-soft);
  border-color: var(--admin-accent);
  color: var(--admin-accent);
}

.mail-tpl-editor {
  min-width: 0;
}

.mail-tpl-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.mail-tpl-chip {
  appearance: none;
  border: 1px solid var(--admin-border);
  background: var(--admin-bg);
  color: var(--admin-text-muted);
  border-radius: 999px;
  padding: 4px 10px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  cursor: pointer;
}

.mail-tpl-chip:hover {
  border-color: var(--admin-accent);
  color: var(--admin-accent);
  background: var(--admin-accent-soft);
}

.mail-tpl-preview-section .mail-tpl-preview-meta {
  margin-bottom: 10px;
}

.mail-tpl-preview-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--admin-text-muted);
  margin-bottom: 4px;
}

.mail-tpl-preview-subject {
  font-size: 14px;
  font-weight: 600;
  color: var(--admin-text);
  word-break: break-word;
}

.mail-tpl-preview-body {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--admin-border);
  border-radius: 6px;
  background: var(--admin-bg);
  color: var(--admin-text);
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: min(40vh, 360px);
  overflow: auto;
}

.mail-tpl-actions {
  margin-top: 8px;
}

.mail-tpl-cron-link a {
  color: var(--admin-accent);
}

@media (max-width: 820px) {
  .mail-tpl-layout {
    grid-template-columns: 1fr;
  }

  .mail-tpl-nav {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .mail-tpl-nav-item {
    flex: 1 1 auto;
  }

  /* Phase 6: マークアップツールのタップ領域 */
  #previewOverlay .viewer-toolbar .viewer-btn,
  #previewOverlay .viewer-toolbar .viewer-icon-btn,
  #previewOverlay .viewer-toolbar .anno-tool-btn {
    min-width: 44px;
    min-height: 44px;
    box-sizing: border-box;
  }

  #previewOverlay .viewer-toolbar .viewer-icon-btn {
    width: 44px;
  }

  #previewOverlay .anno-tool-btn svg {
    width: 18px;
    height: 18px;
  }

  /* Phase 6: ページ詳細サブタブを常時手が届く位置に */
  .subview-toggle {
    position: sticky;
    top: 0;
    z-index: 12;
    margin-top: 8px;
    padding: 8px 0 6px;
    background: var(--white);
    border-bottom: 1px solid var(--paper-line);
  }

  /* Phase 11: Proof rail を上・作業面を下。フィルタはタブ直下で sticky */
  .detail-grid-proof {
    grid-template-columns: 1fr;
  }

  .detail-proof-rail {
    order: -1;
  }

  .page-detail-filter-slot:not(.is-empty) {
    position: sticky;
    top: 48px;
    z-index: 11;
    padding: 8px 0 6px;
    background: var(--white);
    border-bottom: 1px solid var(--paper-line);
  }

  .detail-card .subview-toggle {
    background: var(--white);
  }
}

.admin-logs-filters {
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: flex-end;
}

.admin-logs-date {
  width: auto;
  min-width: 140px;
}

.admin-logs-q {
  min-width: 180px;
}

.admin-logs-range-sep {
  color: var(--admin-text-muted, var(--ink-soft));
  font-size: 13px;
}

.admin-logs-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--admin-border);
  border-radius: 6px;
  background: var(--white);
}

.admin-logs-table-wrap > .detail-sub {
  padding: 18px;
}

.admin-logs-table-wrap .admin-logs-table {
  margin: 0;
}

.admin-logs-pager {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.admin-screen .org-badge.admin-log-status.success {
  background: #dcfce7;
  color: #166534;
}

.admin-screen .org-badge.admin-log-status.failure {
  background: #fee2e2;
  color: #b91c1c;
}

.admin-logs-error {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-logs-actions {
  white-space: nowrap;
  text-align: right;
}

.admin-logs-actions .ghost-btn {
  padding: 4px 10px;
  font-size: 11px;
}

.admin-settings-page .orphan-cleanup-list > .detail-sub {
  padding: 18px;
}

.admin-settings-page .orphan-cleanup-table {
  width: 100%;
  margin: 0;
  border: 0;
}

.admin-settings-page .orphan-cleanup-table th,
.admin-settings-page .orphan-cleanup-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--admin-border);
  text-align: left;
}

.admin-settings-page .orphan-cleanup-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--white);
  color: var(--admin-text-muted);
  font-size: 12px;
  font-weight: 600;
}

.admin-settings-page .orphan-cleanup-table td {
  font-size: 13px;
}

.admin-settings-page .orphan-cleanup-table tbody tr:last-child td {
  border-bottom: 0;
}

@media (max-width: 560px) {
  .admin-modal .admin-field-row {
    grid-template-columns: 1fr;
  }

  .settings-panel,
  .admin-screen.admin-settings-page {
    padding: 18px 16px;
  }

  #projectSettingsRoot .settings-tabs {
    overflow-x: auto;
  }

  #projectSettingsRoot .settings-tabs .subtab {
    min-width: max-content;
    padding-right: 14px;
    padding-left: 14px;
  }

  #projectSettingsRoot .new-proj-member-lists,
  .admin-settings-page .admin-field-row {
    grid-template-columns: 1fr;
  }

  .admin-settings-page .admin-inline-row {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-settings-page .admin-inline-row > button {
    width: 100%;
  }
}

@media (max-width: 720px) {
  .admin-screen .admin-summary {
    grid-template-columns: 1fr;
  }

  .admin-screen .toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .admin-screen .toolbar-right {
    flex-wrap: wrap;
  }

  /* Phase 6: 指摘一覧・ページ一覧をカード型に */
  table.pt-data-table,
  table.pt-data-table thead,
  table.pt-data-table tbody,
  table.pt-data-table tr,
  table.pt-data-table th,
  table.pt-data-table td {
    display: block;
    width: 100%;
  }

  table.pt-data-table {
    border: 0;
    background: transparent;
  }

  table.pt-data-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  table.pt-data-table tbody tr {
    margin: 0 0 10px;
    padding: 10px 12px;
    border: 1px solid var(--paper-line);
    background: var(--white);
    border-radius: 6px;
    box-sizing: border-box;
  }

  table.pt-data-table tbody tr:last-child {
    margin-bottom: 0;
  }

  table.pt-data-table tbody td {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid var(--paper-line);
    box-sizing: border-box;
  }

  table.pt-data-table tbody td:last-child {
    border-bottom: 0;
    padding-bottom: 0;
  }

  table.pt-data-table tbody td:first-child {
    padding-top: 0;
  }

  table.pt-data-table tbody td::before {
    content: attr(data-label);
    flex: 0 0 5.5em;
    max-width: 40%;
    font-family: "IBM Plex Mono", monospace;
    font-size: 10.5px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-soft);
    line-height: 1.4;
    padding-top: 2px;
  }

  table.pt-data-table tbody td:not([data-label])::before,
  table.pt-data-table tbody td[data-label=""]::before {
    content: none;
    display: none;
  }

  table.pt-data-table tbody td > * {
    min-width: 0;
    flex: 1 1 auto;
  }

  table.pt-data-table .page-list-actions-cell .page-list-actions,
  table.pt-data-table .page-list-actions {
    justify-content: flex-start;
  }

  table.pt-data-table .page-list-thumb-cell {
    width: auto;
    text-align: left;
  }

  table.pt-data-table .page-list-thumb-cell > * {
    flex: 0 0 auto;
  }

  table.pt-data-table td.detail-sub {
    display: block;
    padding: 12px 0 0;
  }

  table.pt-data-table td.detail-sub::before {
    content: none;
    display: none;
  }
}
