:root {
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", "Noto Sans JP", sans-serif;
  --color-bg: #f8fafc;
  --color-surface: #ffffff;
  --color-text: #0f172a;
  --color-muted: #64748b;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --shadow-soft: 0 6px 18px rgba(15, 23, 42, 0.08);
  --radius-card: 16px;
  --primary: #10b981;
  --primary-deep: #059669;
  --info: #3b82f6;
  --border-light: #e5e7eb;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background-color: var(--color-bg);
  color: var(--color-text);
}

body {
  margin: 0;
  font-size: 16px;
  line-height: 1.6;
  background: linear-gradient(180deg, #fbfcff, var(--color-bg));
  color: inherit;
}

a {
  color: #1d4ed8;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  display: block;
}

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

input,
select,
textarea {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background-color: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

.container {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 0 16px;
}

.container.layout {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 0;
  align-items: start;
  min-height: 100vh;
  background: linear-gradient(180deg, #fbfcff, var(--color-bg));
}

.main {
  padding: 24px 32px 32px 24px;
  background-color: #fff;
  min-width: 0;
}

.panel {
  background-color: var(--color-surface);
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  padding: 18px 20px;
}

/* ===== サイドバー/レイアウト共通 ===== */
.layout-side {
  position: relative;
  display: flex;
  flex-direction: column;
  align-self: stretch;
}

.sidebar {
  position: sticky;
  top: 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 100%;
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  margin-bottom: 4px;
  font-weight: 700;
  font-size: 14px;
  color: var(--color-text);
}

.side-brand .logo {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
}

.side-title {
  font-size: 12px;
  color: var(--color-muted);
  margin: 8px 8px 6px;
  font-weight: 600;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item a:not(.btn) {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 14px;
  color: var(--color-text);
  border: 1px solid transparent;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.nav-item a:not(.btn):hover {
  background: #f9fafb;
}

.nav-item.active a:not(.btn),
.nav-item a.is-active:not(.btn) {
  background: #eef2ff;
  color: #1e40af;
  border-color: #c7d2fe;
}

.nav-item a.btn {
  display: inline-flex;
}

.side-filter {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  background: #f0f3f9;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.side-filter select,
.side-filter input {
  width: 100%;
}

.side-filter__group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-muted);
}

.side-filter__row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.side-filter__submit {
  align-self: flex-start;
  padding: 8px 12px;
}

.side-filter .tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--color-muted);
  background: #fff;
  border: 1px solid var(--border);
}

.side-filter .btn {
  align-self: flex-start;
}

.btn.primary {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: #fff;
}

.btn.primary:hover {
  background: #1e40af;
}

.menu-open,
.menu-close {
  appearance: none;
  border: 1px solid var(--border-light);
  background: #fff;
  color: var(--color-text);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 16px;
  line-height: 1;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

.menu-open {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 1200;
  display: none;
  align-items: center;
  gap: 8px;
  background: var(--primary);
  border-color: var(--primary-deep);
  color: #fff;
}

.menu-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease;
  z-index: 1100;
}

@media (max-width: 960px) {
  .container.layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .layout-side {
    min-height: 0;
  }

  .main {
    padding: 80px 18px 32px;
  }

  .layout-side .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(82vw, 280px);
    max-width: 320px;
    height: 100vh;
    border-radius: 0;
    transform: translateX(-110%);
    transition: transform 0.28s ease;
    z-index: 1150;
    padding: 24px 18px;
    padding-bottom: 48px;
    margin-bottom: 0;
    overflow-y: auto;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.25);
    background: #fff;
    min-height: auto;
  }

  .layout-side .menu-backdrop,
  .layout-side .menu-open {
    display: block;
  }

  body.nav-open .layout-side .sidebar {
    transform: translateX(0);
  }

  body.nav-open {
    overflow: hidden;
  }

  body.nav-open .menu-backdrop {
    opacity: 1;
    visibility: visible;
  }

  body.nav-open .menu-open {
    opacity: 0;
    pointer-events: none;
  }
}

@media (max-width: 640px) {
  .main {
    padding: 90px 14px 28px;
  }
}

@media (min-width: 961px) {
.layout {
  display: grid;
  min-height: 100vh;
}

  .layout-side .menu-open,
  .layout-side .menu-close,
  .layout-side .menu-backdrop {
    display: none !important;
  }

  .layout-side .sidebar {
    position: sticky;
  }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: #1d4ed8;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(37, 99, 235, 0.25);
  background: #1e40af;
}

.btn:disabled,
.btn[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.65;
  box-shadow: none;
  transform: none;
}

.btn.secondary {
  background: #f8fafc;
  border-color: var(--border);
  color: var(--color-text);
  box-shadow: none;
}

.btn.secondary:hover {
  background: #e2e8f0;
  box-shadow: none;
}

.btn.danger {
  background: #ef4444;
  border-color: #dc2626;
}

.btn.danger:hover {
  background: #dc2626;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(37, 99, 235, 0.12);
  color: #1e3a8a;
}

.muted {
  color: var(--color-muted);
  font-size: 14px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

th {
  font-size: 13px;
  font-weight: 600;
  background: #f8fafc;
  color: #475569;
}

tr:last-child td {
  border-bottom: none;
}

.alert {
  border-radius: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  background-color: #f1f5f9;
}

.alert.success {
  background: #ecfdf3;
  border-color: #bbf7d0;
  color: #047857;
}

.alert.error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}

code,
pre {
  font-family: "JetBrains Mono", "Fira Code", "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 13px;
}

pre {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #0f172a;
  color: #f8fafc;
  max-width: 100%;
  overflow: auto;
}

@media (max-width: 1024px) {
  .container.layout {
    flex-direction: column;
  }

  .main {
    padding: 22px 18px 30px;
  }
}

@media (max-width: 640px) {
  .container {
    width: 100%;
    padding: 0 12px;
  }

  .btn {
    width: 100%;
  }
}

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

.metrics-grid--primary {
  grid-template-columns: 1fr;
  justify-items: center;
  padding: 6px 0;
}

.metrics-grid--secondary {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

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

@media (min-width: 1240px) {
  .metrics-grid--secondary {
    grid-template-columns: repeat(5, minmax(200px, 1fr));
  }
}

@media (max-width: 720px) {
  .metrics-grid--secondary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }
}

@media (max-width: 900px) {
  .metrics-grid--summary {
    grid-template-columns: 1fr;
  }
}

.metrics-grid--single {
  justify-items: center;
}

.metric-card {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: auto;
  padding: 4px 8px;
  background: var(--color-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
}

.metric-card--focus {
  border: 1px solid rgba(37, 99, 235, 0.35);
  box-shadow: 0 10px 18px rgba(37, 99, 235, 0.12);
}

.metric-card__head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  margin-bottom: 0;
}

.metric-card--has-goal-tabs {
  position: relative;
  padding-top: 8px;
  padding-right: 72px;
}

.metric-card__goal-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 8px;
}

.metric-card--has-goal-tabs .metric-card__goal-tabs {
  position: absolute;
  top: 8px;
  right: 8px;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 8px;
  margin: 0;
}

.metric-card--has-goal-tabs .metric-card__goal-tab {
  text-align: center;
}

.metric-card--has-goal-tabs .metric-card__head {
  margin-right: 64px;
}

.metric-card--has-goal-tabs .metric-card__details {
  margin-top: 12px;
}

.metric-card__goal-tab {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--color-surface);
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  padding: 4px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

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

.metric-card__goal-tab:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.metric-card__goal-tab[aria-checked="false"] {
  opacity: 0.85;
}

.metric-card__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-muted);
}

.metric-card__value {
  font-size: 32px;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.1;
}

.metric-card__value span {
  display: inline-block;
  margin-left: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-muted);
}

.metric-card__details {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 2px;
}

.metric-card__detail {
  display: flex;
  flex-direction: column;
  gap: 0;
  align-items: center;
  text-align: center;
  background: var(--color-surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0;
  font-size: 13px;
  color: var(--color-muted);
}

.metric-card__detail dt {
  margin: 0;
  font-weight: 600;
  font-size: 13px;
  color: var(--color-muted);
  white-space: nowrap;
}

.metric-card__detail dd {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text);
}

.metric-card__detail dd span {
  margin-left: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--color-muted);
  white-space: nowrap;
}

.metrics-grid--secondary .metric-card__details {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metrics-grid--secondary .metric-card__detail {
  gap: 2px;
  padding: 6px 10px;
}

.metric-card__footer {
  margin-top: 4px;
  align-self: flex-start;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--color-bg);
  font-size: 13px;
  color: var(--color-muted);
  text-align: left;
}

.metric-card__footer--center {
  align-self: center;
  text-align: center;
}

.metric-card--hero {
  padding: 24px 28px;
  border-radius: 26px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: linear-gradient(180deg, #ffffff 0%, #f4f6fb 100%);
  box-shadow: 0 32px 48px rgba(15, 23, 42, 0.14);
}

.metric-card--hero .metric-card__head {
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.metric-card--hero .metric-card__title {
  font-size: 16px;
  color: var(--color-text);
}

.metric-card--hero .metric-card__value {
  font-size: 46px;
}

.metric-card--hero .metric-card__details {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
  margin-bottom: 10px;
}

@media (min-width: 768px) {
  .metric-card--hero .metric-card__details {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.metric-card--hero .metric-card__detail {
  gap: 6px;
  padding: 12px 16px;
  background: rgba(248, 250, 252, 0.92);
  border: 1px solid rgba(203, 213, 225, 0.5);
}

.metric-card--hero .metric-card__detail dt {
  font-size: 14px;
}

.metric-card--hero .metric-card__detail dd {
  font-size: 24px;
}

.metric-card--hero .metric-card__detail dd span {
  font-size: 14px;
}

.metric-card--hero .metric-card__footer {
  margin-top: 4px;
}

.dashboard-hero {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
  background: transparent;
  padding: 0;
}

.dashboard-hero::before,
.dashboard-hero::after {
  content: none;
}

.dashboard-hero .metric-card--hero {
  width: 100%;
  max-width: 720px;
}

.dashboard-hero .metric-card__effort {
  margin-top: 10px;
  font-size: 13px;
  color: var(--color-muted);
}

.dashboard-metrics-grid {
  width: 100%;
  margin: 0 0 24px;
}

.dashboard-metrics-grid .metric-card {
  padding: 18px 20px;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.26);
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.08);
  background: var(--color-surface);
  gap: 12px;
}

.dashboard-metrics-grid--summary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.team-summary-cards .metric-card {
  align-items: center;
  text-align: center;
  padding: 16px 18px;
  min-height: 140px;
}

.team-summary-cards .metric-card__head {
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.team-summary-cards .metric-card__title {
  color: var(--color-text);
  font-size: 16px;
  font-weight: 600;
}

.team-summary-cards .metric-card__value {
  font-size: 36px;
  line-height: 1.15;
}

.team-summary-cards .metric-card__value span {
  margin-left: 4px;
  font-size: 15px;
}

.team-summary-cards .metric-card__effort {
  margin-top: auto;
}

@media (max-width: 520px) {
  .dashboard-metrics-grid--summary {
    grid-template-columns: 1fr;
  }

  .metrics-grid--secondary .metric-card__details,
  .dashboard-metrics-grid--summary .metric-card__details {
    grid-template-columns: 1fr;
  }

  .metric-card--hero .metric-card__details {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .metric-card--has-goal-tabs {
    padding-right: 8px;
  }

  .metric-card--has-goal-tabs .metric-card__goal-tabs {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-start;
    margin: 4px 0 8px;
    gap: 6px;
  }

  .metric-card--has-goal-tabs .metric-card__head {
    margin-right: 0;
  }
}

.metric-card__effort {
  margin-top: 8px;
  font-size: 12px;
  color: var(--color-muted);
}

.metric-card__detail-empty {
  color: var(--color-muted);
  font-weight: 600;
}

.dashboard-view[data-view="stats"] {
  background: transparent;
}

.dashboard-tabs {
  display: flex;
  gap: 6px;
  margin: 0 0 18px;
  background: var(--color-surface);
  padding: 8px;
  border-radius: 16px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}

.dashboard-tab {
  flex: 1;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

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

.dashboard-view {
  display: none;
  margin: 0;
}

.dashboard-view.is-active {
  display: block;
}

.dashboard-view[data-view="trend"] {
  background: transparent;
  padding: 0;
  border: none;
}

.dashboard-view[data-view="trend"] .panel {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.dashboard-chart-grid {
  display: grid;
  gap: 12px;
  margin: 0;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  grid-auto-rows: 1fr;
}

.dashboard-chart-grid > .dashboard-view {
  height: 100%;
}

.dashboard-chart-grid .panel {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.panel.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 12px;
}

.page-head__cta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-head__cta .btn {
  white-space: nowrap;
}

.panel.page-head h2 {
  font-size: 22px;
  margin: 2px 0 0;
}

.panel.page-head .muted {
  margin-bottom: 2px;
  font-size: 13px;
}

.team-target-editor {
  max-width: 640px;
  margin-top: 12px;
  padding: 16px;
}

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

.team-target-form__label {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
}

.team-target-form__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.team-target-form__controls input[type="number"] {
  width: 140px;
  padding: 8px 12px;
}

.team-target-form__unit {
  color: #6b7280;
  font-size: 14px;
}

.team-target-form__note {
  margin: 0;
  font-size: 13px;
  color: #6b7280;
}

@media (min-width: 981px) {
  .dashboard-tabs {
    display: none;
  }

  .dashboard-view {
    display: block;
    margin: 0;
  }
}

@media (max-width: 980px) {
  .container.layout {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .panel.page-head {
    align-items: flex-start;
  }
}

@media (max-width: 760px) {
  .dashboard-tab {
    padding: 8px 9px;
    font-size: 13px;
  }

  .panel.page-head {
    flex-direction: column;
    gap: 12px;
  }

  .page-head__cta {
    width: 100%;
    flex-direction: column;
  }

  .page-head__cta .btn {
    width: 100%;
    text-align: center;
  }
}

@media (max-width: 540px) {
  .team-target-form__controls {
    flex-direction: column;
    align-items: stretch;
  }

  .team-target-form__controls .btn {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .chart-box {
    height: 200px;
  }
}

@media (max-width: 720px) {
  .metric-card__details {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .metric-card__details {
    grid-template-columns: 1fr;
  }
  .metric-card--hero .metric-card__details {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .metric-card__value {
    font-size: 38px;
  }
}
.panel.metric-card--hero {
  border: 1px solid var(--border);
  background: var(--color-surface);
  box-shadow: none;
}

/* ===== ランキングページ ===== */
.admin-ranking-page {
  --ranking-control-height: 36px;
  padding-bottom: 32px;
}

.admin-ranking-page .panel {
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--border, #e4e7eb);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
  padding: 20px;
  margin-bottom: 16px;
}

.admin-ranking-page .ranking-header {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.admin-ranking-page .ranking-header h1 {
  margin: 0;
  font-size: 24px;
}

.admin-ranking-page .ranking-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-ranking-page .ranking-filter label {
  font-size: 14px;
  color: #6b7280;
  display: inline-flex;
  align-items: center;
  height: var(--ranking-control-height);
}

.admin-ranking-page .ranking-filter input {
  height: var(--ranking-control-height);
  padding: 0 12px;
  border: 1px solid var(--border, #e4e7eb);
  border-radius: 999px;
  background: #fff;
}

.admin-ranking-page .btn {
  height: var(--ranking-control-height);
  padding: 0 16px;
  border: 1px solid var(--border, #e4e7eb);
  background: #fff;
  color: #1f2937;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
  transition: transform 0.15s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.admin-ranking-page .btn:hover {
  transform: translateY(-1px);
  background: #f9fafb;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.14);
}

.admin-ranking-page .btn:focus-visible {
  outline: 2px solid #1d4ed8;
  outline-offset: 3px;
}

.admin-ranking-page .ranking-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.admin-ranking-page .ranking-tab {
  border: none;
  background: #eef2ff;
  color: #1d4ed8;
  min-height: var(--ranking-control-height);
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.admin-ranking-page .ranking-tab.is-active {
  background: #1d4ed8;
  color: #fff;
}

.admin-ranking-page .ranking-tab:focus-visible {
  outline: 2px solid #1d4ed8;
  outline-offset: 2px;
}

.admin-ranking-page .chart-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.admin-ranking-page .chart-box {
  position: relative;
  height: 280px;
}

.admin-ranking-page .chart-note {
  font-size: 13px;
  color: #6b7280;
}

.admin-ranking-page .ranking-list {
  display: grid;
  gap: 8px;
}

.admin-ranking-page .ranking-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #f9fafb;
}

.admin-ranking-page .ranking-item:first-child {
  background: #fef3c7;
  border-color: #fde68a;
}

.admin-ranking-page .ranking-item__left {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  font-weight: 600;
  color: #374151;
}

.admin-ranking-page .ranking-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #1d4ed8;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
}

.admin-ranking-page .ranking-item:first-child .ranking-badge {
  background: #d97706;
}

.admin-ranking-page .ranking-value {
  font-weight: 600;
  color: #0f172a;
  font-size: 16px;
}

.admin-ranking-page .ranking-metric-label {
  font-size: 14px;
  color: #6b7280;
  margin-left: 8px;
  font-weight: 500;
}

.admin-ranking-page .empty-message {
  font-size: 14px;
  color: #6b7280;
  margin: 8px 0 0;
}

@media (max-width: 640px) {
  .admin-ranking-page .ranking-header {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-ranking-page .ranking-filter {
    justify-content: flex-start;
  }

  .admin-ranking-page .chart-box {
    height: 260px;
  }
}

/* ===== ランキングページ ===== */
.trend-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
}

.trend-tab {
  border: none;
  background: #eef2ff;
  color: #1d4ed8;
  min-height: 34px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.trend-tab:hover {
  background: #e0e7ff;
  transform: translateY(-1px);
}

.trend-tab.is-active {
  background: #1d4ed8;
  color: #fff;
}

.trend-tab:focus-visible {
  outline: 2px solid #1d4ed8;
  outline-offset: 2px;
}

.chart-note {
  font-size: 13px;
  color: var(--color-muted);
  margin-top: 8px;
}

.chart-metric-unit {
  margin-left: 6px;
}

.chart-message {
  font-size: 13px;
  color: var(--color-muted);
  margin-top: 6px;
}

.js-error {
  margin-top: 8px;
  color: #b91c1c;
  background: #fee2e2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 8px;
}

@media (max-width: 480px) {
  .trend-tabs {
    gap: 6px;
    margin-bottom: 10px;
  }
  .trend-tab {
    font-size: 13px;
    padding: 0 12px;
    min-height: 32px;
  }
}
/* ===== Memo folding ===== */
.memo-wrapper{
  display:flex;
  flex-direction:column;
  gap:4px;
}
.table-memo{
  display:block;
  position:relative;
  max-height:var(--memo-collapsed-height, 9999px);
  overflow:hidden;
  transition:max-height .25s ease;
  line-height:1.5;
  word-break:break-word;
}
.memo-wrapper.is-expanded .table-memo{
  max-height:none;
}
.memo-toggle{
  align-self:flex-start;
  font-size:12px;
  color:#2563eb;
  background:none;
  border:none;
  padding:0;
  cursor:pointer;
}
.memo-toggle:hover{
  text-decoration:underline;
}
.memo-toggle:focus{
  outline:2px solid #2563eb;
  outline-offset:2px;
}
.memo-wrapper.is-collapsible .memo-toggle{
  display:inline;
}
.memo-toggle[hidden]{
  display:none !important;
}
.memo-wrapper.is-collapsible .table-memo::after{
  content:"";
  position:absolute;
  left:0;
  right:0;
  bottom:0;
  height:18px;
  background:linear-gradient(180deg, rgba(255,255,255,0) 0%, var(--color-surface, #ffffff) 100%);
  pointer-events:none;
  opacity:1;
  transition:opacity .2s ease;
}
.memo-wrapper.is-expanded .table-memo::after{
  opacity:0;
}

