:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #fff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #dbe1e8;
  --primary: #2563eb;
  --danger: #dc2626;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.page-header,
#app,
.auth-panel {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 16px;
}

.page-header h1 { margin: 0 0 8px; font-size: 1.8rem; }
.lead { margin: 0 0 16px; color: var(--muted); }

.run-command-label {
  margin: 0 0 6px;
  font-size: 0.85rem;
  color: var(--muted);
}

.run-command {
  margin: 0;
  padding: 12px 14px;
  background: #111827;
  color: #f9fafb;
  border-radius: 10px;
  font-size: 0.92rem;
  overflow-x: auto;
}

.run-command code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  box-shadow: var(--shadow);
}

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

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.panel-head h2 { margin: 0; font-size: 1.2rem; }

.hint {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.92rem;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.tabs-spacer {
  flex: 1;
}

.tab {
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 16px;
  cursor: pointer;
}

.tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

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

.card-list {
  display: grid;
  gap: 16px;
}

.project-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.project-summary-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 96px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 16px;
  background: #fff;
  cursor: pointer;
  text-align: center;
  font: inherit;
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.project-summary-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.12);
  transform: translateY(-1px);
}

.project-summary-card.is-inactive {
  opacity: 0.62;
  background: #f8fafc;
}

.project-summary-name {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.35;
  word-break: break-word;
}

.project-summary-badge {
  display: inline-block;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
}

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

.home-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 132px;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 44px 18px 18px;
  background: #fff;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.home-card:hover {
  border-color: var(--primary);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.12);
  transform: translateY(-1px);
}

.home-card-title {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
}

.home-card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
}

.home-card-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.home-card-stat-value {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--primary);
}

.home-card-stat-label {
  font-size: 0.78rem;
  color: var(--muted);
}

.home-card-arrow {
  position: absolute;
  top: 18px;
  right: 16px;
  font-size: 1.1rem;
  color: var(--muted);
}

.project-back-btn {
  border: none;
  background: none;
  color: var(--primary);
  font: inherit;
  cursor: pointer;
  padding: 0 0 12px;
  font-weight: 600;
}

.project-back-btn:hover {
  color: #1d4ed8;
}

.field-required {
  color: var(--danger);
  font-size: 0.75rem;
  font-weight: 600;
}

.field-optional {
  color: var(--muted);
  font-size: 0.75rem;
}

.project-wizard-steps {
  display: flex;
  gap: 12px;
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
}

.project-wizard-step {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.project-wizard-step span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 700;
}

.project-wizard-step.is-active {
  color: var(--text);
  font-weight: 600;
}

.project-wizard-step.is-active span,
.project-wizard-step.is-done span {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.project-wizard-card .card-actions {
  margin-top: 16px;
}

.project-detail-card {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.project-detail-head {
  margin-bottom: 12px;
}

.project-detail-title {
  margin: 0;
  font-size: 1.15rem;
}

.project-detail-tabs {
  margin-bottom: 16px;
}

.project-detail-tab-panel {
  display: none;
}

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

.project-source-panel .card-grid {
  margin-top: 0;
}

.project-schedule-table input,
.project-schedule-table select {
  width: 100%;
  min-width: 0;
}

.project-schedule-actions {
  width: 48px;
  text-align: center;
  white-space: nowrap;
}

.project-schedule-actions button {
  min-width: 32px;
  padding: 4px 8px;
}

.project-tasks-panel {
  margin-top: 0;
}

.project-tasks-history-panel {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.project-task-board-wrap {
  display: grid;
  gap: 12px;
}

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

.task-board-panel-head h3 {
  margin: 0;
}

.task-board-notion-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-soft, rgba(255, 255, 255, 0.02));
}

.task-board-columns {
  display: grid;
  grid-template-columns: repeat(5, minmax(180px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.task-board-column {
  min-width: 180px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-soft, rgba(255, 255, 255, 0.02));
  display: flex;
  flex-direction: column;
  min-height: 280px;
}

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

.task-board-column-head h4 {
  margin: 0;
  font-size: 0.9rem;
}

.task-board-count {
  font-size: 0.8rem;
  color: var(--muted);
}

.task-board-column-body {
  flex: 1;
  display: grid;
  gap: 8px;
  padding: 10px;
  align-content: start;
}

.task-board-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--bg, #111);
  cursor: grab;
}

.task-board-card:active {
  cursor: grabbing;
}

.task-board-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.task-board-card-title {
  font-size: 0.88rem;
  line-height: 1.4;
  word-break: break-word;
}

.task-board-card-notion {
  flex-shrink: 0;
  font-size: 0.85rem;
}

.task-board-card-actions {
  margin-top: 8px;
}

.task-board-card-actions select {
  width: 100%;
  font-size: 0.8rem;
}

.task-board-add {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  padding: 10px;
  border-top: 1px solid var(--border);
}

.task-board-add input {
  min-width: 0;
}

.task-board-settings-block {
  margin-bottom: 20px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.task-board-settings-block h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.task-board-settings-block label {
  display: grid;
  gap: 6px;
}

@media (max-width: 1200px) {
  .task-board-columns {
    grid-template-columns: repeat(3, minmax(180px, 1fr));
  }
}

@media (max-width: 768px) {
  .task-board-columns {
    grid-template-columns: repeat(1, minmax(180px, 1fr));
  }
}

.project-tasks-back-btn {
  margin-bottom: 12px;
}

.project-hearing-panel {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.project-hearing-panel--primary {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.project-hearing-panel .panel-head {
  margin-bottom: 8px;
}

.project-hearing-panel h3 {
  margin: 0;
  font-size: 1rem;
}

.hearing-sheet {
  display: grid;
  gap: 16px;
}

.hearing-section h4 {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.hearing-fields {
  display: grid;
  gap: 12px;
}

.hearing-field textarea,
.hearing-field input[type="text"] {
  width: 100%;
}

.hearing-consult-block {
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
}

.hearing-consult-block h4 {
  margin: 0 0 8px;
}

.hearing-consult-actions {
  margin: 12px 0;
}

.hearing-consult-result {
  margin-top: 8px;
}

.project-settings-view .hearing-template-section {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  background: #fbfcfd;
}

.hearing-template-section-head,
.hearing-template-field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.hearing-template-fields {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
}

.hearing-template-field {
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 12px;
  background: #fff;
}

.hearing-template-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  background: #fbfcfd;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.password-field-wrap {
  position: relative;
  display: flex;
  align-items: stretch;
  width: 100%;
}

.password-field-wrap > input {
  flex: 1;
  min-width: 0;
  padding-right: 42px;
}

.password-toggle-btn {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 40px;
  border: none;
  background: transparent;
  color: #9ca3af;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
}

.password-toggle-btn svg {
  width: 20px;
  height: 20px;
  display: block;
}

.password-toggle-btn:hover {
  color: #6b7280;
}

.password-toggle-btn.is-visible {
  color: #374151;
}

body.login-view .login-field .password-field-wrap {
  flex: 1;
  min-width: 0;
}

body.login-view .login-field .password-field-wrap > input {
  border: none;
  background: transparent;
  padding-right: 44px;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="tel"],
input[type="url"],
input[type="number"],
input[type="search"],
select,
textarea {
  width: 100%;
  box-sizing: border-box;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  line-height: 1.25;
  background: #fff;
}

textarea {
  height: auto;
  min-height: 72px;
  resize: vertical;
}

.project-site-url {
  grid-column: 1 / -1;
}

.site-url-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.site-url-controls input {
  flex: 1;
  min-width: 0;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 8px;
  padding: 8px 14px;
  text-decoration: none;
  font: inherit;
  white-space: nowrap;
}

.button-link:hover {
  background: #f8fafc;
}

.direct-instruct-form textarea {
  min-height: 140px;
}

.nexus-instruct-form textarea {
  min-height: 160px;
  margin-bottom: 12px;
}

.image-attach-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
}

.image-attach-row input[type="file"] {
  max-width: 100%;
}

.image-attach-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}

.image-attach-preview.hidden {
  display: none;
}

.image-attach-item {
  position: relative;
  width: 120px;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.image-attach-item img {
  display: block;
  width: 100%;
  height: 90px;
  object-fit: cover;
}

.image-attach-item figcaption {
  padding: 4px 6px;
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.image-attach-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  cursor: pointer;
  line-height: 1;
}

.image-attach-result-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.image-attach-result-list li + li {
  margin-top: 12px;
}

.image-attach-result {
  margin: 8px 0 0;
}

.image-attach-result img {
  max-width: 320px;
  max-height: 240px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.nexus-result-detail {
  margin-top: 4px;
}

.direct-instruct-result-wrap {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.direct-instruct-result-wrap h4 {
  margin: 0 0 12px;
  font-size: 0.95rem;
}

.status-pill.status-run {
  background: #dbeafe;
  color: #1d4ed8;
}

.status-pill.status-wait {
  background: #fef3c7;
  color: #b45309;
}

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

.row input { flex: 1; }

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.card-actions.left-align {
  justify-content: flex-start;
}

button {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  font: inherit;
}

button.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

button.danger {
  color: var(--danger);
  border-color: #fecaca;
  background: #fff5f5;
}

.hidden { display: none !important; }

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  background: #111827;
  color: #fff;
  padding: 12px 16px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  max-width: 360px;
}

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

.oauth-result {
  margin-top: 8px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
  user-select: text;
  white-space: pre-wrap;
}

.oauth-result-ok {
  background: #ecfdf5;
  border: 1px solid #6ee7b7;
  color: #065f46;
}

.oauth-result-error {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #991b1b;
}

.empty {
  padding: 24px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 12px;
}

.full-width {
  grid-column: 1 / -1;
}

.sales-config-grid {
  margin-top: 12px;
}

.checkbox-row-wrap {
  display: flex;
  align-items: end;
  padding-bottom: 8px;
}

.strategy-box {
  white-space: pre-wrap;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  min-height: 64px;
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th,
.data-table td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  vertical-align: top;
  text-align: left;
}

.data-table th {
  background: #f1f5f9;
  white-space: nowrap;
}

.data-table.compact td,
.data-table.compact th {
  font-size: 0.85rem;
}

.data-table a {
  color: var(--primary);
}

.email-body {
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 0.85rem;
  margin: 8px 0 0;
  max-width: 420px;
}

.leads-table td {
  vertical-align: middle;
}

.cell-center {
  text-align: center;
  white-space: nowrap;
}

.sent-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.sent-check input {
  width: auto;
  margin: 0;
  cursor: pointer;
}

.lead-row-sent td:nth-child(2) {
  opacity: 0.65;
}

.lead-row-unsent {
  background: #fffbeb;
}

.lead-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-chip {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.85rem;
}

.filter-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.sent-badge {
  display: inline-block;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 4px;
}

.sent-badge.sent-yes {
  background: #dcfce7;
  color: #166534;
}

.sent-badge.sent-no {
  background: #fef3c7;
  color: #92400e;
}

.notion-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.notion-badge.notion-yes {
  background: #dcfce7;
  color: #15803d;
}

.notion-badge.notion-no {
  background: #ffedd5;
  color: #c2410c;
}

.notion-sync-btn {
  margin-left: 4px;
  font-size: 0.78rem;
}

.sales-approach-chart-wrap {
  margin-top: 12px;
}

.sales-approach-chart-monthly {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-top: 8px;
}

.stacked-bar-chart {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stacked-bar-chart-title {
  margin: 0 0 4px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #0f172a;
}

.stacked-bar-chart-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stacked-bar-chart-row {
  display: grid;
  grid-template-columns: minmax(140px, 220px) minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.stacked-bar-chart-label {
  font-size: 0.82rem;
  color: #334155;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stacked-bar-chart-bar-area {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.stacked-bar-chart-bar {
  display: flex;
  height: 22px;
  min-width: 0;
  border-radius: 4px;
  overflow: hidden;
  background: #f1f5f9;
}

.stacked-bar-chart-segment {
  display: block;
  height: 100%;
  min-width: 1px;
}

.stacked-bar-chart-total {
  flex: 0 0 auto;
  min-width: 2.5em;
  font-size: 0.82rem;
  font-weight: 600;
  color: #0f172a;
  text-align: right;
}

.stacked-bar-chart-axis {
  display: flex;
  justify-content: space-between;
  margin: 0 0 0 calc(min(220px, 28vw) + 12px);
  padding-top: 2px;
  border-top: 1px solid #e2e8f0;
  font-size: 0.72rem;
  color: #64748b;
}

.stacked-bar-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 4px;
}

.stacked-bar-chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: #475569;
}

.stacked-bar-chart-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex: 0 0 auto;
}

.stacked-bar-chart-empty {
  margin: 0;
  font-size: 0.85rem;
  color: #64748b;
}

@media (max-width: 640px) {
  .stacked-bar-chart-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .stacked-bar-chart-axis {
    margin-left: 0;
  }
}

.sales-progress-groups {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sales-progress-group-title {
  margin: 0 0 8px;
  font-size: 1rem;
  color: #0f172a;
}

.sales-progress-count {
  font-size: 0.82rem;
  color: #64748b;
  font-weight: 500;
}

.sales-progress-table select.sales-progress-select {
  min-width: 140px;
  max-width: 220px;
  font-size: 0.82rem;
  padding: 4px 8px;
}

.sales-progress-company {
  font-weight: 600;
}

.send-badge {
  display: inline-block;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.send-badge.send-success {
  background: #dcfce7;
  color: #166534;
  cursor: help;
}

.send-badge.send-failed {
  background: #fee2e2;
  color: #991b1b;
  cursor: help;
}

.send-badge.send-processing {
  background: #fef3c7;
  color: #92400e;
  cursor: help;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.send-badge.send-none {
  background: #f3f4f6;
  color: #9ca3af;
}

.send-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 0.9rem;
  border: 1px solid #fed7aa;
}

.mc-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(154, 52, 18, 0.25);
  border-top-color: #ea580c;
  border-radius: 50%;
  animation: mc-spin 0.7s linear infinite;
  flex: 0 0 auto;
}

.mc-spinner-sm {
  width: 11px;
  height: 11px;
  border-width: 2px;
}

.mc-spinner-primary {
  border: 2px solid rgba(37, 99, 235, 0.2);
  border-top-color: var(--primary);
}

.mc-spinner-lg {
  width: 28px;
  height: 28px;
  border-width: 3px;
}

.mc-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 12px;
}

.mc-loading-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.mc-loading-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 0.9rem;
  border: 1px solid #bfdbfe;
}

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

.mc-tooltip {
  position: fixed;
  z-index: 9999;
  max-width: 440px;
  max-height: 320px;
  overflow: auto;
  padding: 8px 10px;
  border-radius: 6px;
  background: #1f2937;
  color: #f9fafb;
  font-size: 0.8rem;
  line-height: 1.4;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  pointer-events: none;
  white-space: pre-wrap;
  word-break: break-word;
}

.mc-tooltip.hidden {
  display: none;
}

.lead-row-sent {
  background: #f0fdf4;
}

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

.link-btn {
  border: none;
  background: none;
  padding: 0;
  color: var(--primary);
  text-align: left;
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
}

.link-btn:hover {
  color: #1d4ed8;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.modal-dialog {
  position: relative;
  width: min(640px, 100%);
  max-height: calc(100vh - 32px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-radius: 14px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.modal-dialog.modal-wide {
  width: min(920px, 100%);
}

.modal-back-btn {
  border: none;
  background: none;
  color: var(--primary);
  font: inherit;
  cursor: pointer;
  padding: 0;
  margin-right: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
  flex: 1;
  text-align: center;
}

.modal-close {
  border: none;
  background: none;
  font-size: 1.5rem;
  line-height: 1;
  padding: 0 4px;
  color: var(--muted);
}

.modal-body {
  padding: 16px 20px;
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border);
}

.lead-detail {
  margin: 0;
}

.lead-detail dt {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 12px;
}

.lead-detail dt:first-child {
  margin-top: 0;
}

.lead-detail dd {
  margin: 4px 0 0;
}

.lead-detail .email-body {
  max-width: none;
  margin: 0;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}

.lead-compose {
  margin-top: 16px;
  display: grid;
  gap: 8px;
}

.lead-compose label {
  font-size: 0.85rem;
  color: var(--muted);
}

.lead-compose input,
.lead-compose textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
}

.lead-compose textarea {
  resize: vertical;
  min-height: 180px;
  line-height: 1.6;
}

.task-history-table td {
  vertical-align: middle;
}

.status-pill {
  display: inline-block;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e5e7eb;
}

.status-pill.status-ok {
  background: #dcfce7;
  color: #166534;
}

.status-pill.status-ng {
  background: #fee2e2;
  color: #991b1b;
}

.agent-summary,
.diff-stat {
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.85rem;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin: 0;
  max-height: 320px;
  overflow: auto;
}

.file-list {
  margin: 0;
  padding-left: 1.2rem;
}

.file-list code {
  font-size: 0.85rem;
}

/* マーケティング */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.kpi-card {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.kpi-card.kpi-accent {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.kpi-label {
  font-size: 0.78rem;
  color: var(--muted);
}

.kpi-value {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.2;
}

.kpi-sub {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  margin-top: 2px;
}

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

.marketing-advice-panel .panel-head {
  margin-bottom: 4px;
}

.marketing-implement-panel {
  margin-top: 16px;
}

.advice-instruction-wrap {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.advice-instruction-wrap textarea {
  width: 100%;
  min-height: 88px;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  line-height: 1.5;
  resize: vertical;
}

.advice-instruction-actions {
  margin-top: 10px;
}

.advice-box {
  background: linear-gradient(135deg, #fdf4ff 0%, #eff6ff 100%);
  border: 1px solid #e9d5ff;
  border-radius: 12px;
  padding: 16px 18px;
  line-height: 1.7;
}

.advice-instruction-saved-box {
  margin: 12px 0;
  padding: 14px 16px;
  border-radius: 12px;
  background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
  border: 1px solid #a5b4fc;
}

.advice-instruction-saved-box.hidden {
  display: none;
}

.advice-instruction-saved-label {
  margin: 0 0 8px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #4338ca;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.advice-instruction-saved-text {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.6;
}

.advice-cursor-heading {
  margin: 16px 0 8px;
  font-size: 1rem;
  color: var(--muted);
}

.impl-git-ok {
  color: #15803d;
}

.impl-git-ng {
  color: #b91c1c;
}

.impl-files {
  margin: 6px 0 10px 1.2rem;
  font-size: 0.9rem;
}

.impl-diff-stat {
  font-size: 0.8rem;
  background: #f8fafc;
  padding: 8px 10px;
  border-radius: 8px;
  overflow-x: auto;
}

.advice-impl-summary {
  margin-bottom: 10px;
  line-height: 1.6;
}

.advice-generating-banner {
  margin: 0;
  padding: 10px 14px;
  border-radius: 10px;
  background: #eff6ff;
  border: 1px solid #93c5fd;
  color: #1d4ed8;
  font-weight: 600;
}

.advice-done-banner {
  margin: 0;
  padding: 10px 14px;
  border-radius: 10px;
  background: #f0fdf4;
  border: 1px solid #86efac;
  color: #166534;
  line-height: 1.6;
}

.advice-error-banner {
  margin: 0;
  padding: 10px 14px;
  border-radius: 10px;
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #b91c1c;
  font-weight: 600;
}

.poll-setup-hint {
  margin-top: 12px;
  font-size: 0.9rem;
}

.poll-setup-hint summary {
  cursor: pointer;
  color: var(--muted);
}

.advice-highlight-box {
  margin: 12px 0;
  padding: 14px 16px;
  border-radius: 12px;
  background: linear-gradient(135deg, #fff7ed 0%, #fef3c7 100%);
  border: 1px solid #fcd34d;
}

.advice-highlight-box.hidden {
  display: none;
}

.advice-highlight-label {
  margin: 0 0 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #b45309;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.advice-highlight-text {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.6;
}

.advice-action-result-panel {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.advice-action-result-panel h3,
.advice-action-history-panel h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.advice-action-result-box {
  margin-bottom: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  background: linear-gradient(135deg, #ecfdf5 0%, #f0fdf4 100%);
  border: 1px solid #86efac;
  line-height: 1.7;
}

.advice-action-result-box.is-empty {
  background: var(--surface, #f8fafc);
  border-color: var(--border);
}

.advice-action-result-label {
  margin: 0 0 8px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #15803d;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.advice-action-result-text {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.advice-action-history-panel {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.advice-action-history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.advice-action-history-item {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fafafa;
}

.advice-action-history-item header {
  margin-bottom: 6px;
  font-size: 0.85rem;
  color: var(--muted);
}

.advice-action-note-wrap {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.advice-action-note-wrap textarea {
  width: 100%;
  min-height: 88px;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  line-height: 1.5;
  resize: vertical;
}

.advice-history-panel {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
}

.advice-history-panel summary {
  cursor: pointer;
  font-weight: 600;
}

.advice-history-list {
  margin-top: 12px;
}

.advice-history-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.advice-history-item:last-child {
  border-bottom: none;
}

.advice-history-item header {
  margin-bottom: 6px;
}

.advice-history-item p {
  margin: 4px 0;
  line-height: 1.5;
}

.history-label {
  display: inline-block;
  min-width: 5.5em;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
}

.advice-box h3,
.advice-box h4 {
  margin: 12px 0 6px;
  font-size: 1rem;
}

.advice-box ul {
  margin: 6px 0 10px 1.2rem;
  padding: 0;
}

.advice-body p:first-child {
  margin-top: 0;
}

.marketing-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.marketing-split-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.marketing-dashboard-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  width: 100%;
}

.marketing-dashboard-left,
.marketing-dashboard-right {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.marketing-analytics-panel h2 {
  margin: 0 0 12px;
  font-size: 1.2rem;
}

.marketing-subheading {
  margin: 18px 0 8px;
  font-size: 1rem;
}

.marketing-mini-heading {
  margin: 12px 0 6px;
  font-size: 0.95rem;
  color: var(--muted);
}

.google-ads-kpi-grid {
  margin-bottom: 8px;
}

.marketing-split h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.data-table.compact td,
.data-table.compact th {
  padding: 6px 10px;
}

.data-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.page-path-cell {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.85rem;
}

.error-text {
  color: #b91c1c;
  margin-top: 10px;
  font-size: 0.9rem;
}

.sync-errors {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid #b42318;
  border-radius: 8px;
  background: #fef3f2;
  color: #7a271a;
  font-size: 0.9rem;
  line-height: 1.5;
}

.sync-errors p {
  margin: 0 0 0.5rem;
}

.sync-errors p:last-child {
  margin-bottom: 0;
}

.marketing-site-actions {
  flex-wrap: wrap;
  gap: 8px;
}

.marketing-save-row {
  display: flex;
  justify-content: flex-start;
  padding-top: 4px;
}

.marketing-save-row .primary {
  min-width: 160px;
  font-size: 1rem;
  padding: 10px 20px;
}

.site-select {
  min-width: 160px;
  max-width: 220px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  background: #fff;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

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

.ga4-upload-row .ga4-upload-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.ga4-upload-row input[type="file"] {
  flex: 1;
  min-width: 200px;
}

.ga4-file-status.is-ok {
  color: #166534;
}

.persona-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 12px;
}

.persona-card {
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  padding: 16px;
  background: var(--panel-soft, #f9fafb);
}

.persona-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.persona-name {
  margin: 0;
  font-size: 1.05rem;
}

.persona-share {
  font-size: 0.85rem;
  color: #2563eb;
  white-space: nowrap;
}

.persona-summary {
  margin: 0 0 10px;
  font-weight: 600;
  line-height: 1.5;
}

.persona-field {
  margin: 0 0 8px;
  font-size: 0.92rem;
  line-height: 1.5;
}

.persona-field-label {
  font-weight: 600;
  color: #374151;
}

.persona-evidence {
  margin: 4px 0 0;
  padding-left: 1.2rem;
  font-size: 0.88rem;
  color: #4b5563;
}

.persona-evidence-wrap {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #d1d5db;
}

.persona-note {
  grid-column: 1 / -1;
  margin-top: 4px;
}

.persona-raw {
  font-size: 0.8rem;
  max-height: 200px;
  overflow: auto;
  background: #f3f4f6;
  padding: 8px;
  border-radius: 6px;
}

.organic-query-redacted td:first-child {
  color: #6b7280;
  font-style: italic;
}

.organic-query-footnote {
  margin-top: 8px;
}

@media (max-width: 1024px) {
  .marketing-dashboard-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .marketing-split,
  .marketing-split-3 { grid-template-columns: 1fr; }
  .system-stats-split { grid-template-columns: 1fr; }
  .row { flex-direction: column; align-items: stretch; }
  .card-actions { flex-direction: column; }
  .app-shell { flex-direction: column; }
}

/* --- サイドバーレイアウト（サイト管理 / プロジェクト分割） --- */
body.manage-app {
  margin: 0;
}

body.login-view .app-sidebar,
body.login-view .page-header {
  display: none;
}

body.login-view {
  background: #0f172a;
  overflow-x: hidden;
}

body.login-view::before {
  content: "";
  position: fixed;
  inset: -25%;
  z-index: 0;
  background:
    radial-gradient(circle at 22% 28%, rgba(124, 58, 237, 0.75) 0%, transparent 42%),
    radial-gradient(circle at 78% 18%, rgba(13, 148, 136, 0.65) 0%, transparent 38%),
    radial-gradient(circle at 82% 78%, rgba(234, 88, 12, 0.55) 0%, transparent 40%),
    radial-gradient(circle at 12% 82%, rgba(29, 78, 216, 0.6) 0%, transparent 42%),
    #0f172a;
  filter: blur(72px);
  pointer-events: none;
}

body.login-view .app-shell {
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

body.login-view .app-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 32px 16px;
}

body.login-view .auth-panel {
  width: 100%;
  max-width: 400px;
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 0;
}

body.login-view .login-screen-content {
  width: 100%;
}

body.login-view .auth-brand {
  display: flex;
  justify-content: center;
  margin: 0 0 40px;
}

body.login-view .auth-brand-logo {
  display: block;
  width: min(320px, 88vw);
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.35));
}

body.login-view .login-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

body.login-view .login-field {
  display: flex;
  align-items: stretch;
  background: #fff;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.18);
  min-height: 48px;
}

body.login-view .login-field + .login-field {
  margin-top: 2px;
}

body.login-view .login-field-icon {
  flex-shrink: 0;
  width: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  border-right: 1px solid #e5e7eb;
}

body.login-view .login-field-icon svg {
  width: 20px;
  height: 20px;
  display: block;
}

body.login-view .login-field input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 12px 14px;
  font-size: 0.95rem;
  color: #1f2937;
  border-radius: 0;
  outline: none;
}

body.login-view .login-field input::placeholder {
  color: #9ca3af;
}

body.login-view .login-options {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin: 14px 0 20px;
}

body.login-view .login-remember {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

body.login-view .login-remember input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

body.login-view .login-remember-box {
  width: 16px;
  height: 16px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(15, 23, 42, 0.45);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

body.login-view .login-remember-box::after {
  content: "";
  width: 8px;
  height: 5px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translateY(-1px);
  opacity: 0;
}

body.login-view .login-remember input:checked + .login-remember-box::after {
  opacity: 1;
}

body.login-view .login-remember-label {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.92);
}

body.login-view .login-submit {
  width: 100%;
  min-height: 48px;
  border: none;
  border-radius: 0;
  background: #0a1628;
  color: #fff;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.22);
  transition: background 0.15s ease, transform 0.1s ease;
}

body.login-view .login-submit:hover {
  background: #111827;
}

body.login-view .login-submit:active {
  transform: translateY(1px);
}

body.login-view .login-submit:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.75);
  outline-offset: 2px;
}

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

.app-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: #111827;
  color: #f9fafb;
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  gap: 16px;
  align-self: stretch;
  min-height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  padding: 0 4px;
}

.sidebar-brand-logo {
  display: block;
  width: 132px;
  height: auto;
  object-fit: contain;
}

.sidebar-footer {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-profile {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 4px;
}

.sidebar-profile-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 100%;
  text-align: center;
}

.sidebar-profile-company {
  font-size: 0.82rem;
  font-weight: 600;
  color: #f9fafb;
  line-height: 1.35;
  word-break: break-word;
}

.sidebar-profile-contact {
  font-size: 0.78rem;
  color: #9ca3af;
  line-height: 1.35;
  word-break: break-word;
}

.sidebar-user-btn {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: #e5e7eb;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  overflow: hidden;
}

.sidebar-user-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.sidebar-user-btn.has-avatar {
  background: transparent;
}

.sidebar-user-btn.has-avatar:hover {
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 999px;
  overflow: hidden;
}

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

.sidebar-user-icon {
  width: 22px;
  height: 22px;
  display: block;
}

.account-profile-grid .account-profile-full {
  grid-column: 1 / -1;
}

.account-profile-password {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.account-profile-password h4 {
  margin: 0 0 12px;
  font-size: 0.95rem;
  font-weight: 600;
}

#account-profile-modal input[readonly] {
  background: #f3f4f6;
  color: var(--muted);
}

.sidebar-drawer {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 8px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 0 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.sidebar-link,
.sidebar-logout {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: #e5e7eb;
  font-size: 0.92rem;
  line-height: 1.35;
}

.sidebar-link {
  text-decoration: none;
}

.sidebar-link-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.72;
  transition: opacity 0.15s ease;
}

.sidebar-link-label {
  flex: 1;
  min-width: 0;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-link:hover .sidebar-link-icon,
.sidebar-logout:hover .sidebar-link-icon {
  opacity: 0.95;
}

.sidebar-link.active {
  background: var(--primary);
  color: #fff;
}

.sidebar-link.active .sidebar-link-icon {
  opacity: 1;
}

.sidebar-logout {
  width: 100%;
  flex-shrink: 0;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.sidebar-logout:hover {
  background: rgba(255, 255, 255, 0.08);
}

.app-content {
  flex: 1;
  min-width: 0;
  width: 100%;
  max-width: none;
}

.auth-brand {
  display: flex;
  justify-content: center;
  margin: 0 0 20px;
}

.auth-brand-logo {
  display: block;
  width: min(280px, 100%);
  height: auto;
  object-fit: contain;
}

body[data-manage-page="sites"] .app-content {
  display: flex;
  flex-direction: column;
}

.page-header.compact {
  padding: 20px 20px 8px;
  max-width: none;
  margin: 0;
}

.page-header.compact h1 {
  font-size: 1.45rem;
  margin-bottom: 4px;
}

#app,
.auth-panel {
  max-width: none;
  margin: 0;
  padding: 0 20px 24px;
}

.site-toolbar {
  margin-bottom: 12px;
}

.site-toolbar .panel-head {
  margin-bottom: 0;
}

.inline-hint {
  margin: 0;
  font-size: 0.82rem;
}

.system-stats-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.stats-box {
  margin: 0;
  padding: 14px;
  background: #111827;
  color: #f3f4f6;
  border-radius: 10px;
  font-size: 0.85rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-x: auto;
  min-height: 120px;
}

.stats-panel {
  margin: 0;
  padding: 16px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
  min-height: 180px;
}

.stats-box-fallback {
  margin: 0;
  padding: 12px;
  background: #111827;
  color: #f3f4f6;
  border-radius: 8px;
  font-size: 0.82rem;
  white-space: pre-wrap;
}

.metrics-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.metric-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.metric-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}

.metric-value {
  font-size: 0.95rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.metric-track {
  height: 12px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
}

.metric-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.35s ease;
}

.metric-fill.metric-ok,
.metric-value.metric-ok {
  background: #22c55e;
  color: #15803d;
}

.metric-value.metric-ok {
  background: transparent;
}

.metric-fill.metric-warn,
.metric-value.metric-warn {
  background: #f59e0b;
  color: #b45309;
}

.metric-value.metric-warn {
  background: transparent;
}

.metric-fill.metric-danger,
.metric-value.metric-danger {
  background: #ef4444;
  color: #b91c1c;
}

.metric-value.metric-danger {
  background: transparent;
}

.metric-detail {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.metric-platform {
  margin: 4px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.load-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.load-badge.metric-ok {
  background: #dcfce7;
  color: #15803d;
}

.load-badge.metric-warn {
  background: #fef3c7;
  color: #b45309;
}

.load-badge.metric-danger {
  background: #fee2e2;
  color: #b91c1c;
}

.load-avg strong {
  font-variant-numeric: tabular-nums;
}

.system-links {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.link-btn {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 8px;
  background: #eff6ff;
  color: var(--primary);
  text-decoration: none;
  font-size: 0.9rem;
}


.account-edit-grid .account-edit-full {
  grid-column: 1 / -1;
}

.permission-checkboxes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px 16px;
  margin-top: 8px;
}

.permission-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin-top: 8px;
  margin-bottom: 12px;
}

.radio-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
}

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

.field-label {
  display: block;
  font-weight: 600;
  margin-bottom: 4px;
}

.account-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 16px;
}

.account-list-toolbar {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.account-list-filters {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 18px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.account-filter-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.account-filter-field label {
  display: block;
  margin: 0 0 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.account-filter-input,
.account-filter-select {
  width: 100%;
  height: 40px;
  margin: 0;
  padding: 0 12px;
  font-size: 0.9rem;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.account-filter-select {
  padding-right: 32px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M2.5 4.5 6 8l3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.account-filter-input:focus,
.account-filter-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.account-filter-input::placeholder {
  color: #9ca3af;
}

@media (max-width: 720px) {
  .account-filter-row {
    grid-template-columns: 1fr;
  }
}

.account-list-order-hint {
  margin: 0;
}

.account-list-order-hint.is-muted {
  color: var(--muted);
}

.account-card-empty {
  grid-column: 1 / -1;
}

.account-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.account-card:hover {
  border-color: #bfdbfe;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.1);
  transform: translateY(-2px);
}

.account-card.is-inactive {
  opacity: 0.72;
  background: #f8fafc;
}

.account-card.is-inactive:hover {
  transform: none;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.account-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 16px;
}

.account-card-top-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex: 1;
}

.account-card-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  color: #64748b;
  font-size: 1rem;
  line-height: 1;
  cursor: grab;
  flex-shrink: 0;
  touch-action: none;
}

.account-card-drag-handle:active {
  cursor: grabbing;
}

.account-card-drag-handle:hover {
  border-color: #bfdbfe;
  color: #2563eb;
  background: #eff6ff;
}

.account-card.is-dragging {
  opacity: 0.55;
  transform: scale(0.98);
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.18);
  transition: none;
}

.account-card.is-dragging:hover {
  transform: scale(0.98);
}

.account-card.is-drag-over {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.account-card.is-drag-disabled .account-card-drag-handle {
  opacity: 0.35;
  cursor: not-allowed;
}

.account-meta-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
}

.account-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
}

.account-status-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.account-status-badge.is-active {
  background: #ecfdf5;
  color: #047857;
}

.account-status-badge.is-active::before {
  background: #10b981;
}

.account-status-badge.is-inactive {
  background: #f1f5f9;
  color: #64748b;
}

.account-status-badge.is-inactive::before {
  background: #94a3b8;
}

.account-role-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
}

.account-role-badge.account-role-admin {
  background: #fef3c7;
  color: #b45309;
}

.account-role-badge.account-role-project_manager {
  background: #ede9fe;
  color: #6d28d9;
}

.account-role-badge.account-role-engineer_admin,
.account-role-badge.account-role-engineer {
  background: #dbeafe;
  color: #1d4ed8;
}

.account-role-badge.account-role-quality_manager,
.account-role-badge.account-role-quality_control {
  background: #fce7f3;
  color: #be185d;
}

.account-role-badge.account-role-designer {
  background: #ecfdf5;
  color: #047857;
}

.account-card-avatar {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.account-card-avatar-img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #fff;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
}

.account-card-avatar .account-avatar-no-image {
  width: 80px;
  height: 80px;
  font-size: 0.7rem;
  border: 3px solid #fff;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
}

.account-card-body {
  flex: 1;
  text-align: center;
}

.account-card-name {
  margin: 0 0 2px;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.35;
  word-break: break-word;
  color: var(--text);
}

.account-card-company {
  margin: 0 0 14px;
  font-size: 0.82rem;
  color: var(--muted);
}

.account-card-contact {
  text-align: left;
  background: #f8fafc;
  border: 1px solid #eef2f7;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 14px;
}

.account-contact-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 0.82rem;
  line-height: 1.5;
}

.account-contact-row + .account-contact-row {
  margin-top: 6px;
}

.account-contact-label {
  flex-shrink: 0;
  width: 3.2em;
  color: var(--muted);
  font-weight: 600;
}

.account-contact-value {
  flex: 1;
  word-break: break-all;
  color: var(--text);
}

.account-card-perms {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  min-height: 28px;
}

.account-perm-tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #475569;
}

.account-perm-tag-all {
  background: #dbeafe;
  color: #1d4ed8;
}

.account-perm-tag-none {
  background: #fef2f2;
  color: #b91c1c;
}

.account-card-footer {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #eef2f7;
}

.account-card-edit-btn {
  width: 100%;
}

.account-avatar {
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.account-avatar-no-image {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e2e8f0;
  color: #64748b;
  font-weight: 600;
  font-size: 0.625rem;
  letter-spacing: 0.02em;
  text-align: center;
  line-height: 1.2;
  padding: 4px;
}

.account-avatar-edit {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.account-avatar-preview {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  overflow: hidden;
  background: #f1f5f9;
  flex-shrink: 0;
}

.account-avatar-preview img,
.account-avatar-preview .account-avatar-no-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.account-avatar-preview.hidden {
  display: none;
}

.account-avatar-hint {
  margin: 4px 0 0;
}

.card-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.badge.muted {
  background: #f1f5f9;
  color: #64748b;
}

.sidebar-item.hidden {
  display: none;
}

.sidebar-item-has-submenu {
  position: relative;
}

.sidebar-link-parent {
  cursor: default;
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
}

.sidebar-submenu {
  display: none;
  flex-direction: column;
  gap: 2px;
  padding: 2px 0 4px 28px;
}

.sidebar-item-has-submenu:hover .sidebar-submenu,
.sidebar-item-has-submenu:focus-within .sidebar-submenu {
  display: flex;
}

.sidebar-item-has-submenu:hover .sidebar-link-parent,
.sidebar-item-has-submenu:focus-within .sidebar-link-parent,
.sidebar-item-has-submenu.active .sidebar-link-parent {
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-sublink {
  display: block;
  padding: 8px 12px;
  border-radius: 8px;
  color: #d1d5db;
  font-size: 0.88rem;
  line-height: 1.35;
  text-decoration: none;
}

.sidebar-sublink:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.sidebar-sublink.active {
  background: var(--primary);
  color: #fff;
}

.sidebar-link.hidden {
  display: none !important;
}

/* --- スマホ: ハンバーガーメニュー --- */
.sidebar-menu-toggle {
  display: none;
}

.sidebar-backdrop {
  display: none;
}

@media (max-width: 640px) {
  .sidebar-menu-toggle {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    color: #e5e7eb;
    cursor: pointer;
    padding: 0;
  }

  .sidebar-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
  }

  .sidebar-menu-icon {
    width: 20px;
    height: 20px;
    display: block;
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 240;
    background: rgba(0, 0, 0, 0.45);
  }

  body.sidebar-open .sidebar-backdrop {
    display: block;
  }

  .app-sidebar {
    position: sticky;
    top: 0;
    z-index: 250;
    width: 100%;
    min-height: auto;
    max-height: none;
    overflow: visible;
    flex-direction: column;
    padding: 10px 12px;
    gap: 0;
  }

  .sidebar-brand {
    width: 100%;
    gap: 10px;
  }

  .sidebar-brand-logo {
    width: auto;
    max-width: 120px;
    height: 32px;
    object-fit: contain;
  }

  .sidebar-drawer {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 260;
    display: flex;
    flex-direction: column;
    width: min(280px, 86vw);
    height: 100vh;
    height: 100dvh;
    margin: 0;
    padding: 72px 14px 24px;
    gap: 8px;
    background: #111827;
    transform: translateX(-105%);
    transition: transform 0.24s ease;
    visibility: hidden;
    pointer-events: none;
  }

  body.sidebar-open .sidebar-drawer {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
  }

  .sidebar-nav {
    position: static;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0;
    margin: 0;
    gap: 8px;
    background: transparent;
    transform: none;
    visibility: visible;
    pointer-events: auto;
    width: 100%;
    height: auto;
  }

  body.sidebar-open .sidebar-nav {
    transform: none;
    visibility: visible;
    pointer-events: auto;
  }

  .sidebar-link,
  .sidebar-logout {
    width: 100%;
  }

  .sidebar-logout {
    margin-top: 0;
  }

  .sidebar-footer {
    margin-top: auto;
  }

  .sidebar-submenu {
    display: flex;
    padding-left: 28px;
  }

  .sidebar-link-parent {
    cursor: default;
  }
}

.work-report-head {
  flex-wrap: wrap;
  gap: 12px;
}

.work-report-month-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.work-report-month-label {
  margin: 0;
  min-width: 7rem;
  text-align: center;
  font-size: 1.2rem;
}

.work-report-month-btn {
  min-width: 36px;
  padding: 6px 10px;
  font-size: 1.2rem;
  line-height: 1;
}

.work-report-month-input {
  margin-left: 4px;
}

.work-report-total {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.work-report-content-cell,
.work-report-notes-cell {
  max-width: 320px;
  white-space: pre-wrap;
}

.work-report-field-full {
  grid-column: 1 / -1;
}

.work-report-edit-btn,
.work-report-delete-btn {
  padding: 4px 10px;
  font-size: 0.82rem;
}

.work-report-members-panel .hint {
  margin: 6px 0 0;
}

.work-report-member-grid {
  margin-top: 8px;
}

.work-report-member-card {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.work-report-member-card:hover {
  border-color: var(--accent, #2563eb);
}

.work-report-self-badge,
.work-report-view-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
}

.work-report-self-badge {
  background: #dbeafe;
  color: #1d4ed8;
}

.work-report-view-badge {
  background: #f3f4f6;
  color: #4b5563;
}

.work-report-member-meta {
  margin: 8px 0 0;
  font-size: 0.85rem;
  color: #6b7280;
}

.work-report-detail-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 220px;
}

.work-report-back-link {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 6px 12px;
  text-decoration: none;
}

.work-report-target-inner {
  display: flex;
  align-items: center;
  gap: 10px;
}

.work-report-target-avatar,
.work-report-target-avatar.account-avatar-no-image {
  width: 40px;
  height: 40px;
  border-radius: 999px;
}

.work-report-readonly-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: #fef3c7;
  color: #92400e;
  font-size: 0.82rem;
  font-weight: 600;
}

.work-report-head .hidden {
  display: none !important;
}

.work-report-table th.hidden,
.work-report-table td.hidden {
  display: none !important;
}

.work-report-manage-panel .panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.work-report-manage-payment-note {
  margin: 0;
  color: #6b7280;
  font-size: 0.88rem;
}

.work-report-manage-member-wage {
  margin: 6px 0 0;
  color: #2563eb;
  font-size: 0.86rem;
  font-weight: 600;
}

.work-report-manage-detail-panel .work-report-head {
  margin-bottom: 16px;
}

.work-report-manage-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.work-report-manage-summary-card {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.work-report-manage-summary-card-accent {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.work-report-manage-summary-label {
  color: #6b7280;
  font-size: 0.82rem;
}

.work-report-manage-summary-value {
  font-size: 1.25rem;
  line-height: 1.2;
}

.work-report-manage-payment-value {
  font-size: 0.95rem;
}

.work-report-manage-target-company {
  display: block;
  margin-top: 2px;
  color: #6b7280;
  font-size: 0.86rem;
  font-weight: 400;
}

.work-report-manage-chart-panel {
  margin-bottom: 20px;
  padding: 16px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
}

.work-report-manage-chart-title {
  margin: 0 0 12px;
  font-size: 1rem;
}

.work-report-manage-chart {
  min-height: 240px;
}

.work-report-manage-line-chart {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  min-height: 240px;
}

.work-report-manage-line-chart .work-report-manage-line-chart-grid,
.work-report-manage-line-chart .mkt-line-chart-grid {
  stroke: #e5e7eb;
  stroke-width: 1;
}

.work-report-manage-line-chart .work-report-manage-line-chart-axis,
.work-report-manage-line-chart .mkt-line-chart-axis {
  stroke: #d1d5db;
  stroke-width: 1.2;
}

.work-report-manage-line-chart .work-report-manage-line-chart-y,
.work-report-manage-line-chart .work-report-manage-line-chart-x,
.work-report-manage-line-chart .mkt-line-chart-y,
.work-report-manage-line-chart .mkt-line-chart-x {
  fill: #6b7280;
  font-size: 11px;
  font-family: ui-sans-serif, system-ui, sans-serif;
}

.work-report-manage-line-chart .work-report-manage-line-chart-dot,
.work-report-manage-line-chart .mkt-line-chart-dot {
  cursor: pointer;
}

.work-report-manage-table-wrap {
  margin-top: 4px;
}

@media (max-width: 960px) {
  .work-report-manage-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .work-report-manage-summary-grid {
    grid-template-columns: 1fr;
  }
}

.work-report-month-end-section {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border, #e5e7eb);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
}

.work-report-month-end-note {
  margin: 0;
  color: var(--muted, #6b7280);
  font-size: 0.875rem;
}

.work-report-month-end-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.work-report-month-end-lead {
  margin: 0 0 1rem;
  color: var(--muted, #6b7280);
}

.work-report-month-end-entries-wrap {
  margin-bottom: 1rem;
}

.work-report-month-end-entries-title {
  margin: 0 0 0.5rem;
  font-size: 0.9375rem;
  font-weight: 600;
}

.work-report-month-end-entries-table-wrap {
  max-height: 16rem;
  overflow: auto;
}

.work-report-month-end-entries-table .work-report-content-cell,
.work-report-month-end-entries-table .work-report-notes-cell {
  max-width: 12rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.work-report-month-end-summary {
  margin: 0;
  display: grid;
  gap: 0.75rem;
}

.work-report-month-end-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  background: var(--surface-muted, #f9fafb);
}

.work-report-month-end-row dt {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted, #6b7280);
}

.work-report-month-end-row dd {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
}

.work-report-month-end-row-accent {
  background: rgba(37, 99, 235, 0.08);
}

.work-report-month-end-row-accent dd {
  color: #2563eb;
}

.work-report-month-end-invoice-section {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border, #e5e7eb);
  display: grid;
  gap: 0.5rem;
}

.work-report-month-end-invoice-note {
  margin: 0;
  color: #dc2626;
  font-size: 0.875rem;
  font-weight: 600;
}

.work-report-month-end-invoice-label {
  font-size: 0.875rem;
  font-weight: 600;
}

.work-report-manage-month-end-alert {
  margin: 0.35rem 0 0;
  color: #dc2626;
  font-size: 0.875rem;
  font-weight: 700;
}

.work-report-manage-month-end-section {
  margin: 1rem 0 0.5rem;
}

.work-report-manage-month-end-invoice-wrap {
  margin-top: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.work-report-manage-month-end-invoice-label {
  font-size: 0.875rem;
  font-weight: 600;
}

.work-report-invoice-file-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 1rem;
  padding: 0.875rem 1rem;
  border-radius: 0.5rem;
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.18);
}

.work-report-invoice-file-label {
  font-weight: 700;
  color: #1d4ed8;
}

.work-report-invoice-file-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.work-report-invoice-empty-note {
  margin: 0 0 1rem;
  color: var(--muted, #6b7280);
  font-size: 0.875rem;
}

/* --- スマホ共通（640px 以下） --- */
@media (max-width: 640px) {
  body.manage-app {
    overflow-x: clip;
  }

  .page-header.compact {
    padding: 12px 12px 6px;
  }

  .page-header.compact h1 {
    font-size: 1.25rem;
  }

  #app,
  .auth-panel {
    padding: 0 12px 20px;
  }

  .panel {
    padding: 14px;
    border-radius: 12px;
  }

  .panel-head h2 {
    font-size: 1.05rem;
  }

  .panel-head .head-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .head-actions .button-link,
  .head-actions button,
  .head-actions .link-btn {
    flex: 1 1 auto;
    min-width: 0;
  }

  .tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin-left: -4px;
    margin-right: -4px;
    padding-bottom: 2px;
  }

  .tabs::-webkit-scrollbar {
    display: none;
  }

  .tab {
    flex-shrink: 0;
  }

  .card-grid,
  .home-card-grid,
  .project-summary-grid {
    grid-template-columns: 1fr;
  }

  .account-card-grid {
    grid-template-columns: 1fr;
  }

  .site-url-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .site-url-controls .button-link {
    width: 100%;
    justify-content: center;
  }

  .site-select {
    min-width: 0;
    max-width: 100%;
    width: 100%;
  }

  .marketing-site-actions {
    width: 100%;
  }

  .marketing-site-actions .inline-hint {
    flex-basis: 100%;
    width: 100%;
  }

  .marketing-save-row .primary {
    min-width: 0;
    width: 100%;
  }

  .card-actions {
    align-items: stretch;
  }

  .card-actions button,
  .card-actions .button-link {
    width: 100%;
    justify-content: center;
  }

  .modal {
    padding: 0;
    align-items: stretch;
  }

  .modal-dialog,
  .modal-dialog.modal-wide {
    width: 100%;
    max-width: none;
    max-height: 100vh;
    max-height: 100dvh;
    height: 100%;
    border-radius: 0;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding-left: 14px;
    padding-right: 14px;
  }

  .modal-footer {
    flex-wrap: wrap;
  }

  .modal-footer button {
    flex: 1 1 auto;
    min-width: 0;
  }

  .work-report-detail-nav {
    min-width: 0;
    width: 100%;
  }

  .work-report-head {
    flex-direction: column;
    align-items: stretch;
  }

  .work-report-month-nav {
    justify-content: center;
  }

  .work-report-invoice-file-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .work-report-invoice-file-actions {
    width: 100%;
  }

  .work-report-invoice-file-actions button,
  .work-report-invoice-file-actions .button-link {
    flex: 1 1 auto;
    min-width: 0;
  }

  .sales-progress-table select.sales-progress-select {
    min-width: 0;
    max-width: 100%;
    width: 100%;
  }

  .hearing-template-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .hearing-template-actions button {
    width: 100%;
  }
}

.work-report-invoice-badge {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
  font-size: 0.75rem;
  font-weight: 600;
  vertical-align: middle;
}

