  :root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --surface2: #f0f1f4;
    --border: #e2e4e9;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #eff6ff;
    --accent: #0ea5e9;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --success: #22c55e;
    --success-light: #f0fdf4;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --text: #111827;
    --text-2: #6b7280;
    --text-3: #9ca3af;
    --sidebar-w: 240px;
    --header-h: 56px;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,.10);
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  body { font-family: 'Hiragino Sans', 'Meiryo', sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }

  /* ── Layout ── */
  #app { display: flex; min-height: 100vh; }
  #sidebar { width: var(--sidebar-w); background: #1e293b; color: #e2e8f0; display: flex; flex-direction: column; position: fixed; top: 0; left: 0; height: 100vh; z-index: 100; }
  #main { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
  #header { height: var(--header-h); background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 24px; gap: 12px; position: sticky; top: 0; z-index: 50; box-shadow: var(--shadow); }
  #content { flex: 1; padding: 24px; }

  /* ── Sidebar ── */
  .sidebar-logo { padding: 16px 20px; border-bottom: 1px solid rgba(255,255,255,.08); }
  .sidebar-logo .logo-text { font-size: 16px; font-weight: 700; color: #fff; letter-spacing: .02em; }
  .sidebar-logo .logo-sub { font-size: 11px; color: #94a3b8; margin-top: 2px; }
  .sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 0; }
  .nav-group { margin-bottom: 4px; }
  .nav-group-label { font-size: 10px; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: .08em; padding: 12px 20px 4px; }
  .nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 20px; cursor: pointer; color: #94a3b8; font-size: 13px; transition: all .15s; border-left: 3px solid transparent; }
  .nav-item:hover { color: #e2e8f0; background: rgba(255,255,255,.05); }
  .nav-item.active { color: #fff; background: rgba(37,99,235,.25); border-left-color: var(--primary); }
  .nav-item .nav-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
  .sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; color: #64748b; }

  /* ── Header ── */
  .breadcrumb { display: flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 13px; flex: 1; }
  .breadcrumb .current { color: var(--text); font-weight: 600; }
  .header-actions { display: flex; align-items: center; gap: 8px; }
  .user-badge { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 20px; background: var(--surface2); font-size: 13px; cursor: pointer; }
  .avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }

  /* ── Page ── */
  .page { display: none; }
  .page.active { display: block; }
  .page-header { margin-bottom: 20px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
  .page-title { font-size: 20px; font-weight: 700; color: var(--text); }
  .page-desc { font-size: 13px; color: var(--text-2); margin-top: 4px; }

  /* ── Card ── */
  .card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
  .card-body { padding: 20px; }
  .card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
  .card-title { font-size: 14px; font-weight: 600; }

  /* ── Buttons ── */
  .btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 6px; font-size: 13px; font-weight: 500; cursor: pointer; border: none; transition: all .15s; white-space: nowrap; }
  .btn-primary { background: var(--primary); color: #fff; }
  .btn-primary:hover { background: var(--primary-dark); }
  .btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
  .btn-secondary:hover { background: var(--surface2); }
  .btn-danger { background: var(--danger); color: #fff; }
  .btn-danger:hover { background: #dc2626; }
  .btn-ghost { background: transparent; color: var(--text-2); border: 1px solid transparent; }
  .btn-ghost:hover { background: var(--surface2); color: var(--text); }
  .btn-sm { padding: 5px 10px; font-size: 12px; }
  .btn:disabled { opacity: .5; cursor: not-allowed; }

  /* ── Form ── */
  .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
  .form-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
  .form-full { grid-column: 1 / -1; }
  .form-group { display: flex; flex-direction: column; gap: 5px; }
  .form-label { font-size: 12px; font-weight: 600; color: var(--text-2); }
  .form-label .req { color: var(--danger); margin-left: 2px; }
  .form-control { padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; color: var(--text); background: var(--surface); transition: border .15s; }
  .form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
  select.form-control { cursor: pointer; }
  .form-hint { font-size: 11px; color: var(--text-3); }

  /* ── Table ── */
  .table-wrap { overflow-x: auto; }
  table { width: 100%; border-collapse: collapse; }
  th { background: var(--surface2); font-size: 12px; font-weight: 600; color: var(--text-2); padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
  td { padding: 11px 14px; border-bottom: 1px solid var(--border); font-size: 13px; }
  tr:last-child td { border-bottom: none; }
  tr:hover td { background: #fafbfc; }

  /* ── Search bar ── */
  .search-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
  .search-bar .form-group { min-width: 140px; }

  /* ── Badge ── */
  .badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; white-space: nowrap; }
  .badge-active { background: var(--success-light); color: #166534; }
  .badge-inactive { background: var(--surface2); color: var(--text-3); }
  .badge-blue { background: var(--primary-light); color: var(--primary-dark); }
  .badge-warning { background: var(--warning-light); color: #92400e; }

  /* ── Modal ── */
  .modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; }
  .modal { background: var(--surface); border-radius: 10px; box-shadow: var(--shadow-md); width: 100%; max-width: 560px; max-height: 90vh; display: flex; flex-direction: column; }
  .modal-lg { max-width: 720px; }
  .modal-header { padding: 20px 24px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
  .modal-title { font-size: 16px; font-weight: 700; }
  .modal-body { padding: 20px 24px; overflow-y: auto; flex: 1; }
  .modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
  .btn-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-2); line-height: 1; padding: 4px; }

  /* ── Toast ── */
  #toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 999; display: flex; flex-direction: column; gap: 8px; }
  .toast { background: #1e293b; color: #f8fafc; padding: 12px 18px; border-radius: 8px; font-size: 13px; box-shadow: var(--shadow-md); display: flex; align-items: center; gap: 8px; animation: slideIn .2s; min-width: 240px; }
  .toast.success { border-left: 4px solid var(--success); }
  .toast.error { border-left: 4px solid var(--danger); }
  @keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

  /* ── Loading ── */
  .spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .6s linear infinite; }
  @keyframes spin { to { transform: rotate(360deg); } }
  .loading-row td { text-align: center; padding: 32px; color: var(--text-3); }

  /* ── Empty ── */
  .empty-state { text-align: center; padding: 48px 24px; color: var(--text-3); }
  .empty-state .empty-icon { font-size: 40px; margin-bottom: 12px; }
  .empty-state p { font-size: 14px; }

  /* ── Switch ── */
  .switch-wrap { display: flex; align-items: center; gap: 8px; }
  .switch { position: relative; display: inline-block; width: 36px; height: 20px; }
  .switch input { opacity: 0; width: 0; height: 0; }
  .slider { position: absolute; inset: 0; background: var(--border); border-radius: 20px; cursor: pointer; transition: .2s; }
  .slider:before { content: ''; position: absolute; height: 14px; width: 14px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
  input:checked + .slider { background: var(--primary); }
  input:checked + .slider:before { transform: translateX(16px); }

  /* ── Divider ── */
  .divider { height: 1px; background: var(--border); margin: 16px 0; }

  /* ── Chip ── */
  .chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; background: var(--primary-light); color: var(--primary-dark); border-radius: 4px; font-size: 11px; font-weight: 600; }

  /* ── Dashboard ── */
  .stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
  .stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
  .stat-label { font-size: 12px; color: var(--text-2); margin-bottom: 8px; }
  .stat-value { font-size: 28px; font-weight: 700; color: var(--text); }
  .stat-sub { font-size: 12px; color: var(--text-3); margin-top: 4px; }

  /* ── Org tree ── */
  .tree-node { padding: 4px 0; }
  .tree-node-content { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 6px; cursor: pointer; }
  .tree-node-content:hover { background: var(--surface2); }
  .tree-children { padding-left: 20px; border-left: 2px solid var(--border); margin-left: 18px; }

  /* Scrollbar */
  ::-webkit-scrollbar { width: 6px; height: 6px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

  /* ── Goal Sheet ── */
  .gs-status-draft            { background: var(--surface2);       color: var(--text-2); }
  .gs-status-submitted        { background: var(--primary-light);  color: var(--primary-dark); }
  .gs-status-manager_reviewing{ background: var(--warning-light);  color: #92400e; }
  .gs-status-approved         { background: var(--success-light);  color: #166534; }
  .gs-status-rejected         { background: var(--danger-light);   color: var(--danger); }
  .goal-item-row { border-bottom: 1px solid var(--border); }
  .goal-item-row:last-child { border-bottom: none; }
  .goal-item-header { padding: 12px 20px; background: var(--surface2); font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 12px; }
  .goal-item-body { padding: 16px 20px; }
  .rank-select { padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; font-weight: 600; cursor: pointer; }
  .rank-S  { background: #ede9fe; color: #7c3aed; }
  .rank-A\+ { background: #dbeafe; color: #1d4ed8; }
  .rank-A  { background: #dbeafe; color: #1d4ed8; }
  .rank-A- { background: #dbeafe; color: #1d4ed8; }
  .rank-B\+ { background: #dcfce7; color: #166534; }
  .rank-B  { background: #dcfce7; color: #166534; }
  .rank-B- { background: #dcfce7; color: #166534; }
  .rank-C  { background: #fef9c3; color: #92400e; }
  .rank-D  { background: #fee2e2; color: #991b1b; }
  .rank-E  { background: #1e293b; color: #f1f5f9; }

  /* フェーズバッジ */
  .phase-badge { display:inline-flex; align-items:center; gap:5px; padding:4px 10px; border-radius:20px; font-size:12px; font-weight:700; }
  .phase-initial  { background:#dbeafe; color:#1d4ed8; }
  .phase-midterm  { background:#fef9c3; color:#854d0e; }
  .phase-adjust   { background:#ffedd5; color:#9a3412; }
  .phase-final    { background:#dcfce7; color:#166534; }
  .phase-step { display:flex; gap:0; margin-bottom:16px; }
  .phase-step-item { flex:1; text-align:center; padding:8px 4px; font-size:11px; font-weight:600; background:#f0f4ff; color:#94a3b8; border-top:3px solid #e2e8f0; }
  .phase-step-item.active { background:#eff6ff; color:#1d4ed8; border-top-color:#2563eb; }
  .phase-step-item.done   { background:#f0fdf4; color:#166534; border-top-color:#22c55e; }
  .adjusted-row { background:#fff7ed !important; }
  .back-btn { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 13px; cursor: pointer; margin-bottom: 16px; }
  .back-btn:hover { color: var(--text); }

  /* ── Goal Sheet Excel-style ── */
  .gs-header-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-bottom: 0; }
  .gs-header-table td { border: 1px solid #b0b8c8; padding: 4px 8px; }
  .gs-header-table .gs-ht-label { background: #c6d0e8; font-weight: 700; color: #1e3060; white-space: nowrap; width: 70px; }
  .gs-header-table .gs-ht-val { background: #fff; color: #111; }
  .gs-header-table .gs-ht-title { background: #1e3060; color: #fff; font-size: 15px; font-weight: 700; text-align: center; letter-spacing:.05em; }

  .gs-sheet-table { width: 100%; border-collapse: collapse; font-size: 12px; table-layout: fixed; }
  .gs-sheet-table th { background: #c6d0e8; color: #1e3060; font-weight: 700; border: 1px solid #b0b8c8; padding: 6px 8px; text-align: center; vertical-align: middle; }
  .gs-sheet-table td { border: 1px solid #b0b8c8; padding: 4px 6px; vertical-align: middle; background: #fff; }
  .gs-sheet-table td.gs-td-theme { background: #e8ecf5; font-weight: 700; color: #1e3060; font-size: 11px; }
  .gs-sheet-table td.gs-td-period { background: #dce3f0; font-weight: 700; color: #1e3060; text-align: center; width: 32px; font-size: 11px; writing-mode: vertical-rl; }
  .gs-sheet-table td.gs-td-weight { background: #e8ecf5; font-weight: 700; color: #1e3060; text-align: center; width: 36px; }
  .gs-sheet-table td.gs-td-input { background: #fff; padding: 2px 4px; }
  .gs-sheet-table td.gs-td-eval { background: #fffbf0; padding: 2px 4px; }
  .gs-sheet-table td.gs-td-comment { background: #f5f8ff; padding: 2px 4px; }
  .gs-sheet-table td.gs-td-score { background: #f0f4ff; text-align: center; font-weight: 700; width: 48px; }
  .gs-sheet-table td.gs-td-nogoal { background: #f5f5f5; color: #888; font-size: 11px; }
  .gs-cell-input { width: 100%; border: none; background: transparent; font-size: 12px; padding: 2px 4px; resize: none; font-family: inherit; color: var(--text); }
  .gs-cell-input:focus { outline: 1px solid var(--primary); background: #fffde7; }
  .gs-cell-input[readonly], .gs-cell-input[disabled] { color: var(--text-2); }
  textarea.gs-cell-input { overflow: hidden; min-height: 36px; resize: vertical; }
  .gs-rank-sel { width: 100%; border: none; background: transparent; font-size: 12px; font-weight: 700; padding: 2px 2px; cursor: pointer; font-family: inherit; }
  .gs-rank-sel:focus { outline: 1px solid var(--primary); }
  .gs-summary-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 0; }
  .gs-summary-table th { background: #c6d0e8; color: #1e3060; font-weight: 700; border: 1px solid #b0b8c8; padding: 5px 8px; text-align: center; }
  .gs-summary-table td { border: 1px solid #b0b8c8; padding: 6px 8px; background: #fff; vertical-align: top; }
  .gs-summary-table td.gs-sum-label { background: #e8ecf5; font-weight: 700; color: #1e3060; text-align: center; width: 80px; }
  .gs-score-box { background: #1e3060; color: #fff; font-size: 18px; font-weight: 700; text-align: center; padding: 6px 12px; border-radius: 4px; min-width: 60px; display: inline-block; }
  .gs-section-nogoal th { background: #d8d8d8; color: #444; }
