/* ═══════════════════════════════════════════════════
   KENSHI SkillMap System - Main Stylesheet
   Metro/Subway-style skill visualization
   ═══════════════════════════════════════════════════ */

:root {
  --c-primary: #1e293b;
  --c-bg: #f8fafc;
  --c-card: #ffffff;
  --c-border: #e2e8f0;
  --c-text: #1e293b;
  --c-text-sub: #64748b;
  --c-accent: #2563eb;
  --c-success: #22c55e;
  --c-warning: #f59e0b;
  --c-danger: #ef4444;
  --c-purple: #8b5cf6;
  --c-brown: #a16207;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, .1);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, .12);
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'Inter', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 14px;
}

body {
  font-family: var(--font);
  background: var(--c-bg);
  color: var(--c-text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ─── Layout ─── */
.app-container {
  display: grid;
  grid-template-columns: 280px 1fr;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}

.app-header {
  grid-column: 1 / -1;
  background: var(--c-primary);
  color: white;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-header .logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: .5px;
}

.app-header .logo i {
  font-size: 1.4rem;
  color: var(--c-accent);
}

.app-header .header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.app-header .user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .9rem;
  font-weight: 600;
  opacity: .95;
}

.hamburger-btn {
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px;
  display: none;
}

/* ─── Sidebar ─── */
.sidebar {
  background: var(--c-card);
  border-right: 1px solid var(--c-border);
  padding: 20px 0;
  overflow-y: auto;
  height: calc(100vh - 56px);
  position: sticky;
  top: 56px;
}

/* ─── Worker Selector (Browse other workers) ─── */
.worker-selector-section {
  padding: 0 16px 12px;
  border-bottom: 1px solid var(--c-border);
  margin-bottom: 12px;
}

.store-filter-btn {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid var(--c-border);
  background: var(--c-card);
  color: var(--c-text-sub);
  font-size: .7rem;
  cursor: pointer;
  transition: all .2s;
  font-family: var(--font);
}

.store-filter-btn:hover {
  border-color: var(--c-accent);
  color: var(--c-accent);
}

.store-filter-btn.active {
  background: var(--c-accent);
  color: white;
  border-color: var(--c-accent);
}

.worker-card {
  padding: 0 16px 20px;
  border-bottom: 1px solid var(--c-border);
  margin-bottom: 16px;
}

.worker-card .photo-wrap {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  overflow: hidden;
  margin: 0 auto 12px;
  border: 3px solid var(--c-accent);
}

.worker-card .photo-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.worker-card .photo-wrap.placeholder {
  background: linear-gradient(135deg, var(--c-accent), var(--c-purple));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 2rem;
  font-weight: 700;
}

.worker-card .name {
  text-align: center;
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.worker-card .store-name {
  text-align: center;
  font-size: .8rem;
  color: var(--c-text-sub);
  margin-bottom: 8px;
}

.worker-card .meta-row {
  display: flex;
  justify-content: center;
  gap: 16px;
  font-size: .8rem;
  color: var(--c-text-sub);
}

.worker-card .meta-row .stars,
.worker-card .meta-row .level-badge {
  color: var(--c-warning);
}

.worker-card .rate-badge {
  display: block;
  text-align: center;
  margin-top: 12px;
  padding: 8px;
  background: linear-gradient(135deg, var(--c-accent), #3b82f6);
  color: white;
  border-radius: var(--radius-sm);
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform .2s, box-shadow .2s;
}

.worker-card .rate-badge:hover {
  transform: scale(1.03);
  box-shadow: var(--shadow-md);
}

.worker-card .rate-badge small {
  display: block;
  font-size: .7rem;
  font-weight: 400;
  opacity: .8;
}

/* Mini Radar in sidebar */
.mini-radar-wrap {
  margin-top: 12px;
  background: var(--c-bg);
  border-radius: var(--radius-sm);
  padding: 12px;
  cursor: pointer;
  transition: box-shadow .2s;
}

.mini-radar-wrap:hover {
  box-shadow: var(--shadow-sm);
}

.mini-radar-wrap canvas {
  width: 100% !important;
  height: 180px !important;
}

/* ─── License List ─── */
.license-section {
  padding: 0 16px;
}

.license-section h3 {
  font-size: .85rem;
  font-weight: 600;
  color: var(--c-text-sub);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.license-list {
  list-style: none;
}

.license-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: .8rem;
  border-bottom: 1px solid var(--c-border);
}

.license-list li:last-child {
  border-bottom: none;
}

.license-list .lic-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .6rem;
  flex-shrink: 0;
}

.license-list .lic-icon.approved {
  background: var(--c-success);
  color: white;
}

.license-list .lic-icon.pending {
  background: var(--c-warning);
  color: white;
}

.license-list .lic-icon.none {
  background: var(--c-border);
  color: var(--c-text-sub);
}

/* ─── Goal Section ─── */
.goal-section {
  padding: 16px;
  border-top: 1px solid var(--c-border);
  margin-top: 12px;
}

.goal-section h3 {
  font-size: .85rem;
  font-weight: 600;
  color: var(--c-text-sub);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.goal-text {
  font-size: .82rem;
  background: var(--c-bg);
  border-radius: var(--radius-sm);
  padding: 10px;
  min-height: 60px;
  border: 1px solid var(--c-border);
}

.goal-text.editable {
  cursor: text;
  outline: none;
}

.goal-text.editable:focus {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}

/* ─── Main Content ─── */
.main-content {
  padding: 20px;
  overflow-x: auto;
}

/* ─── Skill Map SVG ─── */
.skillmap-container {
  background: var(--c-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--c-border);
  position: relative;
  overflow: hidden;
  min-height: 200px;
  flex: 1;
}

.skillmap-container svg {
  width: 100%;
  height: 100%;
  display: block;
}

.skillmap-container .dim-label {
  font-size: 13px;
  font-weight: 700;
  fill: white;
  pointer-events: none;
}

.skillmap-container .dim-label-bg {
  rx: 4;
  ry: 4;
}

.skillmap-container .skill-node {
  cursor: pointer;
  transition: transform .15s;
}

.skillmap-container .skill-node:hover {
  filter: brightness(1.15);
}

.skillmap-container .skill-label {
  font-size: 7px;
  fill: #334155;
  pointer-events: none;
  font-weight: 600;
  font-family: 'Noto Sans JP', 'Inter', sans-serif;
}

.skillmap-container .edge-line {
  stroke-width: 2.5;
  fill: none;
  opacity: .4;
}

/* Node states */
.node-approved {
  opacity: 1;
}

.node-requested {
  opacity: .8;
  stroke-dasharray: 3, 2;
}

.node-empty {
  opacity: .35;
}

/* ─── Modals ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal-content {
  background: var(--c-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-width: 700px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px;
  transform: scale(.9);
  transition: transform .3s;
}

.modal-overlay.active .modal-content {
  transform: scale(1);
}

.modal-content h2 {
  font-size: 1.2rem;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--c-text-sub);
}

/* Full-screen radar chart modal */
.radar-modal canvas {
  width: 100% !important;
  height: 400px !important;
}

/* ─── Side Menu (Hamburger) ─── */
.side-menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .3);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
}

.side-menu-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.side-menu {
  position: fixed;
  top: 0;
  right: -320px;
  width: 300px;
  height: 100vh;
  background: var(--c-card);
  box-shadow: var(--shadow-lg);
  z-index: 201;
  transition: right .3s;
  padding: 20px;
}

.side-menu.active {
  right: 0;
}

.side-menu h3 {
  font-size: 1rem;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--c-border);
}

.side-menu .menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  cursor: pointer;
  transition: background .2s;
  text-decoration: none;
  color: var(--c-text);
}

.side-menu .menu-item:hover {
  background: var(--c-bg);
}

.side-menu .menu-item i {
  width: 24px;
  text-align: center;
  color: var(--c-accent);
}

/* ─── Boss Controls ─── */
.boss-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.boss-controls select,
.boss-controls input {
  padding: 8px 12px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  font-size: .85rem;
  background: var(--c-card);
}

/* ─── Ranking Table ─── */
.ranking-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
}

.ranking-table th,
.ranking-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--c-border);
  text-align: left;
  font-size: .85rem;
}

.ranking-table th {
  background: var(--c-bg);
  font-weight: 600;
  color: var(--c-text-sub);
  position: sticky;
  top: 0;
}

.ranking-table tr:hover td {
  background: #f1f5f9;
}

.ranking-table .rank-num {
  font-weight: 700;
  color: var(--c-accent);
  width: 40px;
}

.progress-bar {
  height: 8px;
  background: var(--c-border);
  border-radius: 4px;
  overflow: hidden;
  min-width: 100px;
}

.progress-bar .fill {
  height: 100%;
  border-radius: 4px;
  transition: width .5s;
}

/* ─── Pending List ─── */
.pending-list {
  list-style: none;
}

.pending-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  background: var(--c-card);
}

.pending-item .info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pending-item .info .worker-name {
  font-weight: 600;
  font-size: .9rem;
}

.pending-item .info .skill-name {
  font-size: .8rem;
  color: var(--c-text-sub);
}

.pending-item .actions {
  display: flex;
  gap: 6px;
}

.btn {
  padding: 6px 14px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
}

.btn-primary {
  background: var(--c-accent);
  color: white;
}

.btn-primary:hover {
  background: #1d4ed8;
}

.btn-success {
  background: var(--c-success);
  color: white;
}

.btn-success:hover {
  background: #16a34a;
}

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

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

.btn-outline {
  background: transparent;
  border: 1px solid var(--c-border);
  color: var(--c-text-sub);
}

.btn-outline:hover {
  background: var(--c-bg);
}

/* ─── Login Screen ─── */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
}

.login-card {
  background: var(--c-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 48px 40px;
  width: 400px;
  max-width: 90%;
  text-align: center;
}

.login-card h1 {
  font-size: 1.5rem;
  margin-bottom: 8px;
}

.login-card .subtitle {
  font-size: .85rem;
  color: var(--c-text-sub);
  margin-bottom: 32px;
}

.login-card select,
.login-card input {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  margin-bottom: 12px;
}

.login-card .btn {
  width: 100%;
  padding: 12px;
  font-size: 1rem;
  margin-top: 8px;
}

/* ─── Tabs ─── */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--c-border);
}

.tab-btn {
  padding: 10px 20px;
  background: none;
  border: none;
  font-size: .85rem;
  font-weight: 600;
  color: var(--c-text-sub);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all .2s;
}

.tab-btn.active {
  color: var(--c-accent);
  border-bottom-color: var(--c-accent);
}

.tab-panel {
  display: none;
}

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

/* ─── Toasts ─── */
.toast-container {
  position: fixed;
  top: 70px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  background: var(--c-primary);
  color: white;
  font-size: .85rem;
  box-shadow: var(--shadow-md);
  animation: toastIn .3s ease;
}

.toast.success {
  background: var(--c-success);
}

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

.toast.warning {
  background: var(--c-warning);
}

@keyframes toastIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ─── Loading ─── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, .8);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--c-border);
  border-top-color: var(--c-accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

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

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .app-container {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
  }

  /* スマホ: ヘッダーを非表示 */
  .app-header {
    display: none;
  }

  /* スマホ: サイドバーを完全非表示 */
  .sidebar {
    display: none !important;
  }

  .hamburger-btn {
    display: none;
  }

  /* メイン = フル画面 */
  .main-content {
    padding: 0;
    height: 100vh;
    overflow-y: auto;
  }

  .skillmap-container {
    border: none;
    border-radius: 0;
    box-shadow: none;
    min-height: 100vh;
    height: 100vh;
  }

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

  .modal-content {
    width: 95%;
    padding: 16px;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 13px;
  }

  .login-card {
    padding: 32px 24px;
  }
}

/* ═══════════════════════════════════════════
   MOBILE TOP BAR (固定ヘッダー)
   FAB/リセットボタンをフローティングから独立ヘッダーに統合
   ═══════════════════════════════════════════ */

.mobile-top-bar {
  display: none; /* PC では非表示 */
}

@media (max-width: 768px) {
  /* 固定ヘッダー本体 */
  .mobile-top-bar.logged-in {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 52px;
    padding: 0 10px;
    padding-top: env(safe-area-inset-top);
    height: calc(52px + env(safe-area-inset-top));
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    z-index: 600;
    box-shadow: 0 2px 12px rgba(0, 0, 0, .35);
  }

  /* 中央タイトル */
  .mtb-title {
    font-size: .9rem;
    font-weight: 700;
    color: rgba(255, 255, 255, .95);
    letter-spacing: .02em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    text-align: center;
    padding: 0 8px;
  }

  .mtb-right {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  /* メニューボタン（左） */
  .mobile-top-bar .mobile-fab {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--c-accent);
    color: white;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform .15s, background .15s;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
  }

  .mobile-top-bar .mobile-fab:active {
    transform: scale(0.9);
  }

  .mobile-top-bar .mobile-fab.open {
    background: #1d4ed8;
    transform: rotate(90deg);
  }

  /* リセットボタン（右） */
  .mobile-top-bar .mobile-reset-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .15);
    color: white;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    transition: background .15s;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
  }

  .mobile-top-bar .mobile-reset-btn:active {
    background: rgba(255, 255, 255, .3);
  }

  /* スキルマップをヘッダーの下から開始 */
  .main-content {
    padding-top: calc(52px + env(safe-area-inset-top)) !important;
    height: 100vh !important;
    box-sizing: border-box;
  }

  /* スキルマップコンテナ高さをヘッダー分引く */
  .skillmap-container {
    height: calc(100vh - 52px - env(safe-area-inset-top)) !important;
    min-height: 0 !important;
  }

  /* ボスビュー: flex カラムで高さを確保し、タブパネルが画面内に収まるようにする */
  .boss-view-layout {
    display: flex;
    flex-direction: column;
    height: 100%;
  }

  .boss-view-layout .boss-controls {
    flex-shrink: 0;
    background: var(--c-card);
    padding: 8px 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
  }

  .boss-view-layout .tabs {
    flex-shrink: 0;
    background: var(--c-card);
    margin: 0;
    padding: 0 4px;
  }

  .boss-view-layout .tab-panel {
    display: none;
  }

  .boss-view-layout .tab-panel.active {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
  }

  /* スキルマップはタブ内で残り全高を使う */
  .boss-view-layout .tab-panel.active .skillmap-container {
    flex: 1;
    min-height: 0;
    height: 100% !important;
  }
}

/* モバイルパネル背景 */
.mobile-panel-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .4);
  z-index: 510;
  opacity: 0;
  transition: opacity .3s;
}

.mobile-panel-overlay.active {
  display: block;
  opacity: 1;
}

/* メニュー一覧パネル */
.mobile-menu-panel {
  display: none;
  position: fixed;
  top: 70px;
  left: 12px;
  z-index: 520;
  background: var(--c-card);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0, 0, 0, .2);
  padding: 8px;
  width: 220px;
  transform: scale(0.85) translateY(-10px);
  opacity: 0;
  transition: transform .25s ease, opacity .25s ease;
  transform-origin: top left;
}

.mobile-menu-panel.active {
  display: block;
  opacity: 1;
  transform: scale(1) translateY(0);
}

.mobile-menu-panel .mp-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  font-weight: 500;
  color: var(--c-text);
  cursor: pointer;
  transition: background .15s;
  -webkit-tap-highlight-color: transparent;
}

.mobile-menu-panel .mp-item:active,
.mobile-menu-panel .mp-item:hover {
  background: var(--c-bg);
}

.mobile-menu-panel .mp-item i {
  width: 22px;
  text-align: center;
  font-size: 1rem;
  color: var(--c-accent);
}

.mobile-menu-panel .mp-divider {
  height: 1px;
  background: var(--c-border);
  margin: 4px 8px;
}

/* モバイル情報パネル（スライドアップ） */
.mobile-info-panel {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 530;
  background: var(--c-card);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, .15);
  max-height: 80vh;
  overflow-y: auto;
  padding: 8px 16px 24px;
  transform: translateY(100%);
  transition: transform .35s cubic-bezier(.32, .72, .32, 1);
}

.mobile-info-panel.active {
  display: block;
  transform: translateY(0);
}

.mobile-info-panel .drag-handle {
  width: 40px;
  height: 5px;
  background: var(--c-border);
  border-radius: 3px;
  margin: 8px auto 16px;
}

.mobile-info-panel .panel-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-info-panel .panel-title i {
  color: var(--c-accent);
}

/* 職人ミニカード（モバイルパネル内） */
.mobile-worker-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  background: var(--c-bg);
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.mobile-worker-card .mwc-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--c-accent), var(--c-purple));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
  border: 2px solid var(--c-accent);
}

.mobile-worker-card .mwc-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mobile-worker-card .mwc-info {
  flex: 1;
  min-width: 0;
}

.mobile-worker-card .mwc-name {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.mobile-worker-card .mwc-store {
  font-size: .75rem;
  color: var(--c-text-sub);
}

.mobile-worker-card .mwc-stars {
  color: var(--c-warning);
  font-size: .8rem;
}

.mobile-worker-card .mwc-rate {
  background: linear-gradient(135deg, var(--c-accent), #3b82f6);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-weight: 700;
  font-size: .95rem;
  text-align: center;
  flex-shrink: 0;
}

.mobile-worker-card .mwc-rate small {
  display: block;
  font-size: .6rem;
  font-weight: 400;
  opacity: .8;
}

/* ミニレーダー(パネル内) */
.mobile-radar-wrap {
  background: var(--c-bg);
  border-radius: var(--radius-sm);
  padding: 10px;
  margin-bottom: 16px;
}

.mobile-radar-wrap canvas {
  width: 100% !important;
  height: 200px !important;
}

/* 資格一覧(パネル内) */
.mobile-license-list {
  list-style: none;
  margin-bottom: 16px;
}

.mobile-license-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  font-size: .82rem;
  border-bottom: 1px solid var(--c-border);
}

.mobile-license-list li:last-child {
  border-bottom: none;
}

/* 目標(パネル内) */
.mobile-goal-area {
  background: var(--c-bg);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: .82rem;
  min-height: 48px;
  border: 1px solid var(--c-border);
}

/* 申請モードインジケーター */
.mobile-apply-indicator {
  display: none;
}

@media (max-width: 768px) {
  .mobile-apply-indicator {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 500;
    background: var(--c-accent);
    color: white;
    padding: 10px 24px;
    border-radius: 24px;
    font-size: .85rem;
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(37, 99, 235, .4);
    gap: 8px;
    align-items: center;
  }

  .mobile-apply-indicator.active {
    display: flex;
  }

  .mobile-apply-indicator .close-apply {
    background: rgba(255, 255, 255, .3);
    border: none;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .75rem;
    cursor: pointer;
    margin-left: 8px;
  }
}

/* スマホ版 申請ノードハイライト - 静止したまま光るだけ（位置は動かない） */
@keyframes nodePulseGlow {

  0%,
  100% {
    opacity: .35;
  }

  50% {
    opacity: .9;
  }
}

.skill-node.apply-mode-target {
  animation: nodePulseGlow 2s ease-in-out infinite;
}

/* ═══════════════════════════════════════════
   MOBILE SIDEBAR (◀ tab, fullscreen slide-in)
   ═══════════════════════════════════════════ */

/* ◀ Tab button (left edge) */
.mobile-sidebar-tab {
  display: none;
}

@media (max-width: 768px) {
  .mobile-sidebar-tab.logged-in {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    z-index: 490;
    width: 24px;
    height: 64px;
    border-radius: 0 12px 12px 0;
    background: rgba(30, 41, 59, .55);
    color: white;
    border: none;
    border-left: none;
    box-shadow: 2px 0 8px rgba(0, 0, 0, .15);
    font-size: .75rem;
    cursor: pointer;
    transition: background .2s, transform .3s;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-sidebar-tab.logged-in:active {
    background: var(--c-accent);
  }

  .mobile-sidebar-tab.open {
    opacity: 0;
    pointer-events: none;
  }
}

/* Sidebar overlay */
.mobile-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .4);
  z-index: 600;
  opacity: 0;
  transition: opacity .3s;
}

.mobile-sidebar-overlay.active {
  display: block;
  opacity: 1;
}

/* Sidebar panel */
.mobile-sidebar {
  display: none;
  position: fixed;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  background: var(--c-card);
  z-index: 610;
  transition: left .35s cubic-bezier(.32, .72, .32, 1);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
  .mobile-sidebar {
    display: block;
  }

  .mobile-sidebar.active {
    left: 0;
  }
}

/* Sidebar header */
.ms-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top));
  border-bottom: 1px solid var(--c-border);
  background: var(--c-primary);
  color: white;
  position: sticky;
  top: 0;
  z-index: 5;
}

.ms-title {
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ms-close {
  background: rgba(255, 255, 255, .15);
  border: none;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
}

/* Sidebar quick action buttons */
.ms-actions h4 {
  font-size: .82rem;
  font-weight: 700;
  color: var(--c-text-sub);
  margin-bottom: 8px;
}
.ms-action-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  margin-bottom: 6px;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 600;
  color: var(--c-accent);
  cursor: pointer;
  text-align: left;
  transition: background .15s;
}
.ms-action-btn:hover { background: #eff6ff; }

/* Sidebar body sections */
.ms-body {
  padding: 12px 16px 24px;
}

.ms-section {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--c-border);
}

.ms-section:last-child {
  border-bottom: none;
}

.ms-section h4 {
  font-size: .85rem;
  font-weight: 600;
  color: var(--c-text-sub);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
}

/* Worker card in sidebar */
.ms-worker-card {
  background: var(--c-bg);
  border-radius: var(--radius);
  padding: 14px;
}

.ms-wc-top {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.ms-wc-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--c-accent), var(--c-purple));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  border: 2px solid var(--c-accent);
}

.ms-wc-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ms-wc-name {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.ms-wc-store {
  font-size: .78rem;
  color: var(--c-text-sub);
}

.ms-wc-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.ms-wc-meta-item {
  display: flex;
  flex-direction: column;
  padding: 6px 10px;
  background: white;
  border-radius: 8px;
  border: 1px solid var(--c-border);
}

.ms-wc-label {
  font-size: .65rem;
  color: var(--c-text-sub);
  font-weight: 600;
}

.ms-wc-value {
  font-size: .95rem;
  font-weight: 700;
  color: var(--c-text);
}

.ms-wc-rate {
  background: linear-gradient(135deg, var(--c-accent), #3b82f6);
  border: none;
}

.ms-wc-rate .ms-wc-label {
  color: rgba(255, 255, 255, .7);
}

.ms-wc-rate .ms-wc-value {
  color: white;
}

/* Radar in sidebar */
.ms-radar-wrap {
  background: var(--c-bg);
  border-radius: var(--radius-sm);
  padding: 8px;
}

.ms-radar-wrap canvas {
  width: 100% !important;
  height: 200px !important;
}

/* License items in sidebar */
.ms-license-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: .82rem;
  border-bottom: 1px solid var(--c-border);
}

.ms-license-item:last-child {
  border-bottom: none;
}

/* ═══════════════════════════════════════════
   MOBILE GOAL FOOTER
   ═══════════════════════════════════════════ */

.mobile-goal-footer {
  display: none;
}

@media (max-width: 768px) {
  .mobile-goal-footer.logged-in {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 480;
    background: rgba(30, 41, 59, .85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: white;
    padding: 8px 14px;
    gap: 8px;
    align-items: flex-start;
    min-height: 36px;
    pointer-events: none;
  }

  .mgf-icon {
    font-size: .9rem;
    color: var(--c-warning);
    margin-top: 2px;
    flex-shrink: 0;
  }

  .mgf-text {
    font-size: .9rem;
    line-height: 1.45;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    opacity: .92;
    font-weight: 500;
  }
}

/* Level badge */
.level-badge {
  background: var(--c-accent);
  color: white;
  padding: 1px 8px;
  border-radius: 4px;
  font-size: .75rem;
  font-weight: 700;
}

/* ─── Utility ─── */
.hidden {
  display: none !important;
}

.text-center {
  text-align: center;
}

.mt-2 {
  margin-top: 8px;
}

.mt-4 {
  margin-top: 16px;
}

.mb-2 {
  margin-bottom: 8px;
}

.mb-4 {
  margin-bottom: 16px;
}

.gap-2 {
  gap: 8px;
}

.flex {
  display: flex;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

/* ═══════════════════════════════════════════════════
   ADMIN DASHBOARD
   ═══════════════════════════════════════════════════ */

.admin-dashboard {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 56px);
  background: var(--c-bg);
  overflow: hidden;
}

/* ─── Admin Navigation Bar ─── */
.admin-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--c-primary);
  padding: 0 12px;
  position: sticky;
  top: 0;
  z-index: 30;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
  flex-wrap: nowrap;
  gap: 4px;
  flex-shrink: 0;
}

.admin-nav-tabs {
  display: flex;
  gap: 2px;
}

.admin-tab {
  background: transparent;
  color: rgba(255, 255, 255, .7);
  border: none;
  padding: 10px 14px;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  border-bottom: 3px solid transparent;
  transition: all .2s;
  white-space: nowrap;
}

.admin-tab:hover {
  color: white;
  background: rgba(255, 255, 255, .08);
}

.admin-tab.active {
  color: white;
  border-bottom-color: var(--c-accent);
  background: rgba(255, 255, 255, .05);
}

.admin-tab i {
  font-size: .9rem;
}

.admin-nav-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.admin-action-btn {
  background: rgba(255, 255, 255, .1);
  color: rgba(255, 255, 255, .85);
  border: 1px solid rgba(255, 255, 255, .15);
  padding: 7px 14px;
  border-radius: 6px;
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all .2s;
  text-decoration: none;
  white-space: nowrap;
}

.admin-action-btn:hover {
  background: rgba(255, 255, 255, .2);
  color: white;
}

.admin-action-btn.logout {
  border-color: rgba(239, 68, 68, .4);
}

.admin-action-btn.logout:hover {
  background: rgba(239, 68, 68, .3);
}

/* ─── Admin Panels ─── */
.admin-panel {
  display: none;
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  min-height: 0;
}

.admin-panel.active {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#adminWorkerContent,
#adminDataContent {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

#adminPrototypeTab.active {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 6px 10px;
}

.admin-panel-header {
  margin-bottom: 20px;
}

.admin-panel-header h2 {
  font-size: 1.2rem;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-panel-header h2 i {
  color: var(--c-accent);
}

.admin-panel-header p {
  font-size: .85rem;
  color: var(--c-text-sub);
}

/* ─── Map Stats Cards ─── */
.map-stat-cards {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 6px 0 2px;
  justify-content: center;
}

.stat-card {
  background: var(--c-card);
  border: 2px solid var(--c-border);
  border-radius: 8px;
  padding: 6px 14px;
  text-align: center;
  min-width: 56px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .05);
}

.stat-card.total {
  border-color: var(--c-accent);
}

.stat-num {
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.2;
}

.stat-label {
  font-size: .65rem;
  color: var(--c-text-sub);
  margin-top: 1px;
}

/* ─── Admin Worker Layout ─── */
.admin-worker-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  grid-template-rows: minmax(0, 1fr);
  gap: 20px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.admin-worker-list {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.awl-header {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--c-border);
  background: var(--c-bg);
}

.awl-items {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.awl-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--c-border);
  transition: background .15s;
}

.awl-item:hover {
  background: #f1f5f9;
}

.awl-item.selected {
  background: #dbeafe;
  border-left: 3px solid var(--c-accent);
}

.awl-name {
  font-weight: 600;
  font-size: .88rem;
}

.awl-meta {
  font-size: .75rem;
  color: var(--c-text-sub);
  display: flex;
  gap: 8px;
  margin-top: 2px;
}

.awl-level {
  background: var(--c-accent);
  color: white;
  padding: 0 6px;
  border-radius: 3px;
  font-weight: 700;
  font-size: .7rem;
}

/* ─── Admin Worker Detail ─── */
.admin-worker-detail {
  overflow-y: auto;
  height: 100%;
}

.awd-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  color: var(--c-text-sub);
  gap: 12px;
}

.awd-card {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .05);
}

.awd-header-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.awd-photo {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--c-border);
}

.awd-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.awd-photo.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--c-accent);
  color: white;
  font-size: 1.4rem;
  font-weight: 700;
}

.awd-header-row h3 {
  margin: 0;
  font-size: 1.1rem;
}

.awd-meta {
  font-size: .82rem;
  color: var(--c-text-sub);
}

.awd-badge {
  margin-left: auto;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--c-accent);
}

.awd-fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.awd-field {
  display: flex;
  flex-direction: column;
}

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

.awd-field label {
  font-size: .73rem;
  font-weight: 600;
  color: var(--c-text-sub);
  margin-bottom: 3px;
}

.awd-field input,
.awd-field select,
.awd-field textarea {
  padding: 8px 10px;
  border: 1px solid var(--c-border);
  border-radius: 6px;
  font-size: .85rem;
  font-family: inherit;
}

.awd-field input:focus,
.awd-field select:focus,
.awd-field textarea:focus {
  outline: none;
  border-color: var(--c-accent);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, .15);
}

.awd-actions {
  display: flex;
  gap: 8px;
}

/* ─── Admin Worker Skills / Licenses ─── */
.awd-section {
  margin-bottom: 16px;
}

.awd-section h4 {
  font-size: .95rem;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.awd-section h4 i {
  color: var(--c-accent);
}

.awd-dim-group {
  margin-bottom: 10px;
}

.awd-dim-label {
  font-weight: 700;
  font-size: .82rem;
  padding: 4px 10px;
  background: var(--c-bg);
  border-radius: 4px;
  margin-bottom: 4px;
}

.awd-skill-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-bottom: 1px solid #f1f5f9;
  font-size: .82rem;
  transition: background .15s;
}

.awd-skill-item:hover {
  background: #f8fafc;
}

.awd-skill-item.approved {
  background: #f0fdf4;
}

.awd-skill-item.requested {
  background: #fffbeb;
}

.awd-skill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.awd-skill-name {
  flex: 1;
}

.awd-skill-status {
  font-size: .75rem;
  font-weight: 600;
  color: var(--c-text-sub);
}

.awd-skill-item.approved .awd-skill-status {
  color: var(--c-success);
}

.awd-skill-item.requested .awd-skill-status {
  color: var(--c-warning);
}

.awd-skill-actions {
  display: flex;
  gap: 4px;
}

.btn-xs {
  padding: 3px 8px;
  border: none;
  border-radius: 4px;
  font-size: .72rem;
  cursor: pointer;
  font-weight: 600;
  color: white;
}

.btn-xs.btn-success {
  background: var(--c-success);
}

.btn-xs.btn-danger {
  background: var(--c-danger);
}

.btn-xs.btn-primary {
  background: var(--c-accent);
}

.btn-xs:hover {
  opacity: .85;
}

.btn-sm {
  padding: 6px 12px;
  font-size: .8rem;
}

/* ─── Admin Data Management ─── */
.admin-data-layout {
  display: grid;
  grid-template-columns: 180px 1fr;
  grid-template-rows: minmax(0, 1fr);
  gap: 16px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.admin-data-sidebar {
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow-y: auto;
  min-height: 0;
}

.adt-tab {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  padding: 10px 14px;
  font-size: .82rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  border-radius: 8px;
  transition: all .15s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.adt-tab:hover {
  background: #f1f5f9;
}

.adt-tab.active {
  background: var(--c-accent);
  color: white;
  border-color: var(--c-accent);
}

.adt-tab i {
  width: 16px;
  text-align: center;
}

.adt-group {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--c-text-sub);
  padding: 10px 4px 2px;
  margin-top: 2px;
}
.adt-group:first-child {
  margin-top: 0;
  padding-top: 4px;
}

.admin-data-main {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: 10px;
  overflow: hidden;
}

.adt-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--c-border);
  background: var(--c-bg);
}

.adt-tb-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.adt-tb-right {
  display: flex;
  gap: 6px;
}

.adt-grid {
  overflow: auto;
  max-height: calc(100vh - 280px);
}

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

.adt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .8rem;
}

.adt-table th {
  background: var(--c-bg);
  padding: 8px 10px;
  text-align: left;
  font-weight: 700;
  white-space: nowrap;
  border-bottom: 2px solid var(--c-border);
  position: sticky;
  top: 0;
  z-index: 1;
}

.adt-table td {
  padding: 7px 10px;
  border-bottom: 1px solid #f1f5f9;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.adt-table tr:hover {
  background: #f8fafc;
}

.adt-actions {
  white-space: nowrap;
  display: flex;
  gap: 4px;
}

/* ─── Admin Pending ─── */
.admin-pending-wrap {
  max-width: 800px;
}

.admin-pending-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.pending-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: 8px;
  padding: 10px 14px;
  transition: background .15s;
}

.pending-item:hover {
  background: #f8fafc;
}

.pending-item .info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pending-item .worker-name {
  font-weight: 600;
  font-size: .88rem;
}

.pending-item .skill-name {
  font-size: .82rem;
  color: var(--c-text-sub);
  display: flex;
  align-items: center;
}

.pending-item .actions {
  display: flex;
  gap: 6px;
}

/* ─── Admin Responsive ─── */
@media (max-width: 768px) {
  /* モバイルトップバー(52px)分を差し引いた高さにする */
  .admin-dashboard {
    height: calc(100vh - 52px - env(safe-area-inset-top));
  }

  .admin-nav {
    padding: 0 8px;
  }

  .admin-tab {
    padding: 10px 10px;
    font-size: .78rem;
  }

  .admin-tab span {
    display: none;
  }

  .admin-tab i {
    font-size: 1.1rem;
  }

  .admin-action-btn span {
    display: none;
  }

  .admin-action-btn {
    padding: 7px 10px;
  }

  .admin-panel {
    padding: 12px;
  }

  .admin-worker-layout {
    grid-template-columns: 1fr;
  }

  .admin-worker-list {
    max-height: 250px;
  }

  .awl-items {
    max-height: 180px;
  }

  .admin-data-layout {
    grid-template-columns: 1fr;
  }

  .admin-data-sidebar {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .adt-tab {
    padding: 7px 10px;
    font-size: .75rem;
  }
}

/* ─── iOS-style Color Picker ─── */
.color-picker-wrap {
  position: relative;
}

.color-picker-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--c-border);
  border-radius: 8px;
  cursor: pointer;
  background: white;
  font-size: .85rem;
  min-height: 40px;
  transition: border-color .2s, box-shadow .2s;
}

.color-picker-trigger:hover {
  border-color: var(--c-accent);
}

.color-picker-trigger:focus-within {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.color-picker-trigger .cp-swatch {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  flex-shrink: 0;
  border: 2px solid rgba(0, 0, 0, .1);
}

.color-picker-trigger .cp-name {
  flex: 1;
}

.color-picker-trigger .cp-hex {
  font-size: .75rem;
  color: var(--c-text-sub);
  font-family: monospace;
}

.color-picker-trigger .cp-arrow {
  color: var(--c-text-sub);
  font-size: .7rem;
}

.color-picker-dropdown {
  /* Inline accordion — expands below trigger, no overflow-clip issues */
  position: static;
  display: none;
  margin-top: 4px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, .12), 0 1px 6px rgba(0, 0, 0, .06);
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--c-border);
  animation: dropOpen .12s ease;
}

@keyframes dropOpen {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.color-picker-dropdown.open {
  display: block;
}

.color-picker-dropdown .cp-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: .85rem;
  transition: background .12s;
  border-bottom: 1px solid #f1f5f9;
}

.color-picker-dropdown .cp-item:last-child {
  border-bottom: none;
}

.color-picker-dropdown .cp-item:hover {
  background: #f8fafc;
}

.color-picker-dropdown .cp-item.selected {
  background: #eff6ff;
}

.color-picker-dropdown .cp-item .cp-check {
  width: 20px;
  text-align: center;
  color: var(--c-accent);
  font-weight: 700;
}

.color-picker-dropdown .cp-item .cp-swatch {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  flex-shrink: 0;
  border: 1.5px solid rgba(0, 0, 0, .1);
}

.color-picker-dropdown .cp-item .cp-label {
  flex: 1;
  font-weight: 500;
}

.color-picker-dropdown .cp-item .cp-hex {
  font-size: .73rem;
  color: var(--c-text-sub);
  font-family: monospace;
}

/* ═══════════════════════════════════════════
   iOS-STYLE POLISH & SAFE AREA SUPPORT
   ═══════════════════════════════════════════ */

/* Safe area insets for iPhone notch/home indicator */
@supports (padding-top: env(safe-area-inset-top)) {
  body {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }

  @media (max-width: 768px) {
    /* モバイルは mobileTopBar がセーフエリアを処理するので body の padding-top を無効化 */
    body {
      padding-top: 0 !important;
    }

    .mobile-apply-indicator {
      bottom: calc(20px + env(safe-area-inset-bottom));
    }

    .mobile-info-panel {
      padding-bottom: calc(24px + env(safe-area-inset-bottom));
    }

    .mobile-goal-footer.logged-in {
      bottom: env(safe-area-inset-bottom);
    }

    .mobile-sidebar-tab.logged-in {
      left: env(safe-area-inset-left);
    }
  }
}

/* Smooth transitions for all interactive elements */
button, .btn, a, select, input, .mp-item, .awl-item, .pending-item {
  -webkit-tap-highlight-color: transparent;
}

/* iOS-style button press feedback */
.btn:active,
button:active {
  transform: scale(0.97);
}

.btn, button {
  transition: transform 0.1s ease, background 0.2s ease, box-shadow 0.2s ease;
}

/* iOS-style modal transitions */
.modal-overlay {
  transition: opacity 0.3s cubic-bezier(.32, .72, .32, 1);
}

.modal-overlay.active .modal-content {
  animation: modalSlideIn 0.35s cubic-bezier(.32, .72, .32, 1) forwards;
}

@keyframes modalSlideIn {
  from {
    transform: translateY(20px) scale(0.95);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

/* iOS-style toast notifications */
.toast {
  animation: toastSlideIn 0.35s cubic-bezier(.32, .72, .32, 1) forwards,
             toastFadeOut 0.3s ease 2.7s forwards;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

@keyframes toastSlideIn {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes toastFadeOut {
  to {
    transform: translateY(-10px);
    opacity: 0;
  }
}

/* iOS-style loading spinner */
.loading-overlay {
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* iOS-style login card */
.login-card {
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(255, 255, 255, 0.95);
}

/* iOS-style select/input focus */
.login-card select:focus,
.login-card input:focus,
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
  transition: border-color 0.2s, box-shadow 0.2s;
}

/* iOS-style menu panel - blur background */
@media (max-width: 768px) {
  .mobile-menu-panel {
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    background: rgba(255, 255, 255, 0.92);
  }

  .mobile-info-panel {
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    background: rgba(255, 255, 255, 0.95);
  }

  /* Smoother overlay transition */
  .mobile-panel-overlay {
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    transition: opacity .3s ease;
  }
}

/* iOS-style apply mode pulsing animation */
@keyframes applyPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, .5); }
  50% { box-shadow: 0 0 0 8px rgba(37, 99, 235, 0); }
}

.skill-node.apply-mode-target circle:first-child {
  animation: applyPulse 1.5s ease-in-out infinite;
}

/* Smoother sidebar slide */
.mobile-sidebar {
  transition: transform .35s cubic-bezier(.32, .72, .32, 1) !important;
}

.mobile-sidebar-overlay {
  transition: opacity .3s ease !important;
}

/* iOS-style smooth scrolling */
.mobile-info-panel,
.ms-body,
.admin-worker-detail,
.awl-items {
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

/* Prevent overscroll bounce on the map */
@media (max-width: 768px) {
  .skillmap-container {
    overscroll-behavior: none;
  }
}

/* ── PC Zoom Overlay (floating ± buttons over skill map) ── */
@media (min-width: 769px) {
  .skillmap-container { position: relative; }
  .map-zoom-overlay {
    position: absolute;
    top: 12px; right: 12px;
    display: flex; flex-direction: column; gap: 4px;
    z-index: 10;
  }
  .map-zoom-overlay button {
    width: 32px; height: 32px;
    background: rgba(255,255,255,.9);
    border: 1px solid var(--c-border);
    border-radius: 6px;
    cursor: pointer;
    font-size: .85rem;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s;
  }
  .map-zoom-overlay button:hover { background: white; }
}
@media (max-width: 768px) {
  .map-zoom-overlay { display: none; }
}

/* ── Header Logout Button (Worker/Boss PC header) ── */
.header-logout-btn {
  background: rgba(239,68,68,.1);
  border: 1px solid rgba(239,68,68,.3);
  color: #dc2626;
  border-radius: 6px;
  padding: 5px 10px;
  cursor: pointer;
  font-size: .85rem;
  display: flex; align-items: center; gap: 5px;
  transition: background .15s;
}
.header-logout-btn:hover { background: rgba(239,68,68,.2); }

/* ─── List Apply Modal ─── */
.list-apply-modal {
  position: fixed;
  inset: 0;
  z-index: 700;
  background: var(--c-bg);
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.list-apply-modal.active { display: flex; }

.lam-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--c-card);
  border-bottom: 1px solid var(--c-border);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.lam-back {
  background: none;
  border: none;
  font-size: .9rem;
  cursor: pointer;
  color: var(--c-text);
  padding: 6px 10px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  white-space: nowrap;
}
.lam-back:hover { background: var(--c-bg); }

.lam-title-area {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}
.lam-title {
  font-weight: 700;
  font-size: .92rem;
}
.lam-subtitle {
  font-size: .75rem;
  color: var(--c-text-sub);
  margin-top: 1px;
}

.lam-unsaved {
  font-size: .82rem;
  font-weight: 700;
  color: var(--c-warning);
  white-space: nowrap;
}

.lam-submit {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: var(--c-accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(37,99,235,.3);
  white-space: nowrap;
}
.lam-submit:disabled {
  opacity: .45;
  cursor: not-allowed;
  box-shadow: none;
}

.lam-body {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 40px;
}

.lam-section { margin-bottom: 4px; }

.lam-section-head {
  position: sticky;
  top: 0;
  background: var(--c-bg);
  padding: 8px 16px 6px;
  font-size: .83rem;
  font-weight: 700;
  border-left: 4px solid var(--c-accent);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 2;
  margin-bottom: 2px;
}

.lam-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--c-border);
  transition: background .12s;
}
.lam-item.selectable { cursor: pointer; }
.lam-item.selectable:hover { background: #f0f7ff; }
.lam-item.lam-selected { background: #eff6ff; }

.lam-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.lam-item.lam-approved { background: #f0fdf4; }
/* ドット色はカテゴリ色をJSのインラインスタイルで設定 */

.lam-name {
  flex: 1;
  font-size: .88rem;
}
.lam-new { color: var(--c-warning); font-weight: 700; }

.lam-status {
  font-size: .8rem;
  font-weight: 500;
  white-space: nowrap;
}
.lam-item.lam-approved .lam-status { color: var(--c-success); font-weight: 600; }
.lam-item.lam-requested .lam-status { color: var(--c-warning); }
.lam-item.lam-empty    .lam-status  { color: #9ca3af; }
.lam-item.lam-selected .lam-status  { color: var(--c-accent); font-weight: 700; }